项目在注册登录时不拦截,其他接口都要拦截:

springboot添加排除拦截命名空间

排除这两个接口的拦截:
 

    public void addInterceptors(InterceptorRegistry registry) {
//        addPathPatterns添加需要拦截的命名空间;
//        excludePathPatterns添加排除拦截命名空间
        registry.addInterceptor(new PassportInterceptor()).addPathPatterns("/**").excludePathPatterns("/register").excludePathPatterns("/login");
    }

相关文章: