很简单,通过参数里面的handler来获取,话不多说,直接上代码!
if (handler instanceof HandlerMethod) {
HandlerMethod method = (HandlerMethod) handler;
if (method != null) {
//获取方法上的注解
PreAuthorize preAuthorize = method.getMethodAnnotation(PreAuthorize.class);
if (preAuthorize != null) {
String sn = preAuthorize.sn();
}
}
}