方法的注解只左作用于这个方法,类注解作用于这个类(类里面所以的方法)
这里使用的自己写登录权限的自定义注解
方法
获取方法的注解
//实例化
HandlerMethod handlerMethod = (HandlerMethod) handler;
//返回此处理程序方法的方法,也就是取得接口的方法
Method method = handlerMethod.getMethod();
//获取方法上面的注解
method.getAnnotation(注解的名称.class);
类
获取类的注解
method.getDeclaringClass().getAnnotation(注解的名称.class);