问题场景
注解如下
public @interface GlobalQueueLock {
String mode() default "block";
String lockName() default "globalQueueLock";
int expire() default 30;
}
aop pointcut如下
@Pointcut("@annotation(com.sf.annotation.GlobalQueueLock)")
public void pointcut() {
}
aop around方法中拿注解信息
GlobalQueueLock globalQueueLock = ms.getMethod().getAnnotation(GlobalQueueLock.class);
结果globalQueueLock 为空
问题解决
低级错误,注解上需要加上
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})