No mapping for GET /swagger-ui.html
这是在@EnableWebMvc的注释之下,原先swagger2的默认地址失效了,所有需要重新配置
在SwaggerConfig配置类中继承 WebMvcConfigurer,重写addResourceHandlers方法
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations(
"classpath:/static/");
registry.addResourceHandler("swagger-ui.html").addResourceLocations(
"classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations(
"classpath:/META-INF/resources/webjars/");
WebMvcConfigurer.super.addResourceHandlers(registry);
}
阅读剩余
版权声明:
作者:IT博士
链接:https://itboshi.com/?p=78
文章版权归作者所有,未经允许请勿转载。
THE END