Java – spring AOP: @ annotation (annotation)
I (of course) try to maintain the project with many structures I don't know very well In trying to figure out the use of AOP in spring, I encountered a method with the following comments:
@Around(value =“@ annotation(annotation)”)
So @ around means that we execute the 'around' version of the method pointcut in AOP. I see I don't know what the other parts mean The spring documentation provides the following:
I don't know what this means – "methods implemented in spring AOP" sounds like suggested methods, but I don't know how I (or spring) find the suggested methods It sounds like a method with "given comments", but if so, what comments are given?
What methods does this note suggest? What else does that mean?
Solution
If you have the following spring beans:
@Component public class foo { @com.pkg.Bar void fooMe() { } }
Then there are the following recommendations:
@Around("@annotation(com.pkg.Bar)")
The interceptor will be called around foome (or any other spring bean method annotated with @ bar)
@The transactional annotation is a good example