【发布时间】:2015-08-15 22:19:06
【问题描述】:
我在这个论坛上阅读了很多问题,但没有任何效果。
public @interface MyAnnotation {
String value() default "";
Class[] exceptionList;
}
@MyAnnotation(value="hello", exceptionList={TimeOutException.class})
public void method() {}
@Aspect
public class MyAspect {
@Around("@annotation(MyAnnotation)")
public Object handle(ProceedingJoinPoint joinPoint, MyAnnotation myAnnotation) {
System.out.println(myAnnotation.exceptionList); // should print out TimeOutException
}
}
如何在执行建议时获得@MyAnnotation 的value 和exceptionList?
我正在使用 Spring 4.0.6、AspectJ 1.7.4
【问题讨论】:
-
请显示“MyAnnotation”的内容
标签: aspectj spring-aop