Spring AOP (Aspect-Oriented Programming) Flashcards
What is Aspect-Oriented Programming (AOP) in Spring?
A programming paradigm that allows separation of cross-cutting concerns, such as logging and transaction management, from business logic.
What is a JoinPoint in Spring AOP?
A point in the application execution, such as method execution, where an aspect can be applied.
What is a Pointcut in Spring AOP?
A set of JoinPoints where an advice (code) should be executed.
What is an Advice in Spring AOP?
Action taken by an aspect at a particular join point, such as before, after, or around method execution.
What is @Aspect in Spring AOP?
An annotation to declare a class as an aspect, which contains advice.
What is a Proxy in Spring AOP?
An object that acts as a substitute for another object and intercepts method calls, usually used to apply aspects.
How does @Before advice work in Spring AOP?
It executes before the target method is invoked.
How does @AfterReturning advice work in Spring AOP?
It runs after the target method has successfully returned a result.
What is the purpose of @Around advice in Spring AOP?
It surrounds a method execution, allowing you to run code both before and after the method execution.
How can you declare a pointcut expression in Spring AOP?
Using an expression like execution(* com.example.service..(..)) inside @Pointcut.