项目中添加swagger依赖时报空指针异常
Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException、
这里我用的swagger和ui都是2.9.2的版本,但是我的springboot是2.6的版本
Springfox使用的路径匹配是基于AntPathMatcher的,而Spring Boot 2.6.X使用的是PathPatternMatcher,两种解决方案如下:
1、修改SpringBoot的版本,去使用早期版本即可解决这个问题;
2、在配置文件中加入
spring.mvc.pathmatch.matching-strategy=ant_path_matcher