AOP中获取注解
// 环绕通知:类似与动态代理的全过程
// 携带参数ProceedingJoinPoint,且必须有返回值,即目标方法的返回
@Around(value = "execution(* me.lichunlong.spring.service.*.*(..)) && @annotation(log)")
public Object aroundMethod(ProceedingJoinPoint pjd, LogAnnotation log) {
Object result = null;
System.out.println(log.desc());
try {
System.out.println("前置通知");
result = pjd.proceed();
System.out.println("后置通知");
} catch (Throwable e) {
System.out.println("异常通知");
}
System.out.println("返回通知");
return result;
}