作者:jinshiyuan1123 | 来源:互联网 | 2023-10-13 22:11
只需要在注册拦截路径时去处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);}