1 、SpringBoot启动类加上  注解 @EnableWebMvc

@SpringBootApplication
@EnableWebMvc

public class Application {
   public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
2、 继承 WebMvcConfigurationSupport 加载配置类重写原有 addResourceHandlers 方法,添加需过滤地址
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}

3、检查项目中其它拦截器拦截请求代码

接下来访问 http://localhost:8088/swagger-ui.html

 SpringBoot  swagger-ui.html 配置类继承 WebMvcConfigurationSupport 类后 请求404

 

相关文章:

  • 2021-08-19
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2021-06-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2021-07-22
  • 2021-05-26
  • 2021-07-02
相关资源
相似解决方案