关于swagger遇到的问题
项目报错
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
解决办法
在application.yml中添加以下配置
mvc:
pathmatch:
matching-strategy: ant_path_matcher
不知道什么原理,应该是改了什么路径,暂且不理,代码能跑就行
忘记在哪看到的,记录一下
访问swagger404
在swagger配置类中添加以下代码
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/swagger-ui/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
}
参考https://www.jianshu.com/p/7e60e9121cb8