Springboot 整合 Swagger 后,查看生成Api文档:发现 swagger-ui.html访问不了,页面报错404
SwaggerConfig配置类重写addResourceHandlers方法
public class SwaggerConfig implements WebMvcConfigurer {
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}