Spring AOP I
advice in Spring AOP
Before advice
This is executed before the method is executed, that is, before the corresponding joinpoint
spring AOP II
Enable aspect annotation
If you are using spring1.x, then add a bean
<!-- 开启aop注解 --> <bean class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator"> <property name="proxyTargetClass" value="true"></property> </bean>
If it is spring 2.x or above, use the xsd configuration method
<aop:aspectj-autoproxy proxy-target-class="true"></aop:aspectj-autoproxy>
For @pointcut this annotation is method-level, and if the modified object is public, it can be directly referenced in pointcut in other classes, similar to
@pointcut(“package.SystemCommonsAspect.commonPointcut1()。。。
advice in the form of @aspectj
@before
@afterreturning
@afterThrowing
@after
@around
@declareParents
Next, we will learn about