注意:
Spring 切面注解的顺序
- @before
- @Around( 要代理的方法执行在其中)
- @AfterReturning
- @after
没有@Around,则 要代理的方法执行 异常才会被@AfterThrowing捕获;
在@Around如何执行 要代理的方法执行
@Around("execution(* cn.com.xalead.spring.MeInterface.*(..)) || execution(* cn.com.xalead.spring.KingInterface.*(..))")
public Object test(ProceedingJoinPoint proceeding) {
Object o = null;
try {
//执行
o = proceeding.proceed(proceeding.getArgs());
} catch (Throwable e) {
e.printStackTrace();
}
return o;
}