只需要在注册拦截路径时去处Swagger的路径即可 重点在于Swagger的路径,同Swagger报404的配置的静态资源的路径稍有不同,这里的配置具体如下
@Overridepublic void addInterceptors(InterceptorRegistry registry) {registry.addInterceptor(interceptor).addPathPatterns("/**").excludePathPatterns("/user/logIn").excludePathPatterns("/user/logOut").excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");super.addInterceptors(registry);}