全局过滤器实现用户登录判定
在需要进行过滤的地方新建过滤器Interceptor,去实现HandlerInterceptor,并重写其中的三个方法
@Slf4j
public class Userinterceptor implements HandlerInterceptor {
@Override//处理之前
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response,
Object handler) throws Exception {
String authorization = request.getHeader("authorization");