AspectJ获取方法注解的信息

在使用Aspectj获取方法注解信息的时候,可以使用下面的代码片段:

    /**
     * Get value of annotated method parameter
     */
    private <T extends Annotation> T getMethodAnnotation(ProceedingJoinPoint joinPoint, Class<T> clazz) {
        MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
        Method method = methodSignature.getMethod();
        return method.getAnnotation(clazz);
    }

  

原文地址:https://www.cnblogs.com/rollenholt/p/3848405.html