关于注解AOP,基于类和方法的实现

1.定义注解,标签加上
@Target({ElementType.TYPE,ElementType.METHOD})   type:放类上   method:放方法上.

 

 

2.aop切面操作

@Pointcut("@annotation(com.elim.spring.support.MyAnnotation)" 匹配所有的方法上拥有MyAnnotation注解的方法外部调用。
@Pointcut("@within(com.elim.spring.support.MyAnnotation)" 匹配类上拥有MyAnnotation注解的方法外部调用。

 

 


 

 


 

 

  

posted @ 2020-12-02 14:36  SimpleSmile  阅读(516)  评论(0编辑  收藏  举报