[Asm] 纯文本查看 复制代码 /**
*
* 用户登录拦截器
*
*/
@Slf4j
public class UserLoginInterceptor extends HandlerInterceptorAdapter {
@Autowired
private StringRedisTemplate stringRedisTemplate;
//过滤未登录用户
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
log.info("用户登录拦截器");
this.hasPermission(handler,request);
return true;
}
/**
* 是否有权限
*/
private boolean hasPermission(Object handler,HttpServletRequest request) {
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
// 获取方法上的注解
PxCheckLogin pxCheckPermission = handlerMethod.getMethod().getAnnotation(PxCheckLogin.class);
}
return true;
}
}
如代码可以获取方法上的注解,但是类上的注解怎么判断呢 |