在使用Aspectj获取方法注解信息的时候,可以使用下面的代码片段:
/** * Get value of annotated method parameter */ privateT getMethodAnnotation(ProceedingJoinPoint joinPoint, Class clazz) { MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); Method method = methodSignature.getMethod(); return method.getAnnotation(clazz); }