| | |
| | | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
| | | if(handler instanceof HandlerMethod){ |
| | | HandlerMethod handlerMethod = (HandlerMethod) handler; |
| | | Class<?> beanType = handlerMethod.getBeanType(); |
| | | if (!beanType.isAnnotationPresent(LoginNoRequired.class) && !handlerMethod.hasMethodAnnotation(LoginNoRequired.class)) { |
| | |
| | | throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"未登录"); |
| | | } |
| | | } |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"未登录"); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |