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

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


2.aop切面操作

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


关于注解AOP,基于类和方法的实现_外部调用_02