A pointcut is an expression for the selection of joinpoints. It can be a collection of joinpoints used to define an advice that has to be executed. By defining pointcuts you can have control of the objects composing the application, at the points where the advices are applied.
As Spring defines method invocation joinpoints, all the methods that can be invoked on a class will be joinpoints.
These are some examples of pointcuts:
Methods starting with a certain prefix (such as,
getter
andsetter
)Methods with a particular package (such as
org.springaop.domain.*
)Methods that return a certain kind of output (such as
public MyClass get*(...)
)Any combination of the previous three examples
A pointcut is the composition of a ClassFilter
and a MethodMatcher
. A ClassFilter
narrows the matching of a pointcut or introduction to a given set of target classes, while a MethodMatcher
checks whether the target method is eligible for advice.
public interface Pointcut { public...