Failed to start bean ‘documentationPluginsBootstrapper‘
这个错误是由Springfox的一个bug引起,解决这个问题的方式有多重,最简单的方法就是在配置文件yml中添加spring.mvc.pathmath.matching-strategy: ant_path_matcher即可解决这个问题
·
最近写项目发现导入Swagger2依赖会报错Failed to start bean ‘documentationPluginsBootstrapper‘
这个错误是由Springfox的一个bug引起,解决这个问题的方式有多种,最简单的方法就是在配置文件yml中添加spring.mvc.pathmath.matching-strategy: ant_path_matcher
即可解决这个问题
同样也可以在SwaggerConfig配置类中修改,如下:
@Configuration
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurationSupport {
/*
* No mapping for GET /emge-api/swagger-ui.html
* documentationPluginsBootstrapper
*
* */
@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/");
super.addResourceHandlers(registry);
}
}
SwaggerConfig继承WebMvcConfigurationSupport并实现其方法即可解决报错问题
更多推荐
已为社区贡献1条内容
所有评论(0)