简体   繁体   中英

what is the difference between value and pointcut attributes in advices of spring aop

In advice methods of types Afterreturning and Afterthrowing, there are value and pointcut attributes available. When I tried some hands on, found that both are replaceable with each other and if both present, pointcut takes precedence over value. Can someone please throw a light on difference between these two attributes in context of spring AOP advices.

There is no difference between the two. If both are defined, pointcut takes precedence. Also, if only the value attribute is present, the keyword can me omitted allowing use of @AfterThrowing("com.something.something.something") instead of @AfterThrowing(pointcut = "com.something.something.something") which simplifies the expression.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM