Dependency Injection and AOP. Proxy. Limits of object-oriented programming. AOP. AOP. Advice.
the crosscutting concerns should be analysed as a third dimension of the design. In these situations, aspect-oriented programming provides support to object-oriented programming for uncoupling modules that implement crosscutting concerns.
Spring permits only method execution to be used as a joinpoint. So we can't use with Spring AOP all the features of AOP, but we can do so with AspectJcalled by Spring. For example, we must use the support of AspectJif we want to use as a joinpoint:
Methods starting with a certain prefix (such as, getter and setter)
Methods with a particular package (such as org.springaop.domain.*)
Methods that return a certain kind of output (such as public MyClass get*(...))
A pointcut is the composition of a ClassFilter and a MethodMatcher.
So it contains both the action to be executed (defined in the advice) and the point where it is to be executed (defined in the pointcut). The advisor's role is to decouple pointcuts and advice, in order to reuse them independently from each other.
a normal advice can be applied to any object since it has a per-class lifecycle,
This allows us to focus our attention and development on crosscutting concerns to apply through the proxy, rather than focus on the proxy.
setTarget: Specify the target object you want to proxy.
setProxyTargetClass: The default behavior is the following: