- @Aspect
- @Pointcut(“execution(…)”)
- @Around("…()")
- @Before("…()")
- @After("…()")
- @AfterReturnning(…())
Aspect指示器 | 功能描述 |
---|---|
args() | 根据方法(函数层面)入参对象类型 |
@args() | 根据方法(函数层面)入参对象的注解 |
target() | 根据目标对象(类层面)类型(包含子类) |
@target() | 根据目标对象(类层面)的注解 |
this() | 类似target(),但不包含子类 |
@annotation() | 指定注解标注的所有方法 |
within() | 类似execution ,但只能到类层面 |
@within() | |
execution() | … |
execution 详解
execution(public * (…)) 匹配所有目标类的所有public 方法
execution( pre(…)) 匹配所有目标类的所有以pre为前缀的方法
execution(* run(int, String))
> 这里是引用