The aspect is automatically cut based on Aspect annotations, saving the annotation judgment logic handler

Parent article  spring aop aspect configuration_aop aspect setting.**_Personal scum record is only a blog for self-search-CSDN Blog

[Spring AOP] @Aspect combined with case details (1): @Pointcut uses @annotation + five kinds of notification Advice annotations (with source code attached)_@pointcut @annotation_tiangang gg's blog-CSDN blog

@annotation
The @annotation method means: the entry point is to specify the annotation that acts on the method, that is, the annotation will be executed when the annotation is scanned by Spring.

@Pointcut(value = "@annotation(com.tiangang.aop.MethodLog)")
public void pointCut() {

}
1
2
3
4

In Spring, there are three implementations of AOP:

Spring 1.2 interface-based configuration: Spring's earliest AOP implementation was completely interface-based. Although compatible, it is not recommended.
Spring 2.0+ schema-based configuration: After Spring 2.0, schema-based configuration is provided, that is, xml configuration.
Spring2.0+ @Aspect configuration: After Spring2.0, @Aspect annotation-based implementation is also provided, which is the protagonist of this article, and it is also the most convenient and widely used method at present! (recommend)

—————————————

Guess you like

Origin blog.csdn.net/fei33423/article/details/131969974