http://blinkfox.com/shi-yong-spring-aoplai-tong-ji-fang-fa-de-zhi-xing-shi-jian/

时间:2024-10-13 00:06:43

http://blinkfox.com/shi-yong-spring-aoplai-tong-ji-fang-fa-de-zhi-xing-shi-jian/

spring-aop.xml

  1. @Component
  2. @Aspect
  3. public class AspectDef {
  4. //@Pointcut("execution(* com.test.spring.aop.pointcutexp..JoinPointObjP2.*(..))")
  5. //@Pointcut("within(com.test.spring.aop.pointcutexp..*)")
  6. //@Pointcut("this(com.test.spring.aop.pointcutexp.Intf)")
  7. //@Pointcut("target(com.test.spring.aop.pointcutexp.Intf)")
  8. //@Pointcut("@within(org.springframework.transaction.annotation.Transactional)")
  9. //@Pointcut("@annotation(org.springframework.transaction.annotation.Transactional)")
  10. @Pointcut("args(String)")
  11. public void pointcut1() {
  12. }
  13. @Before(value = "pointcut1()")
  14. public void beforeAdvice() {
  15. System.out.println("pointcut1 @Before...");
  16. }