Spring Boot升级到2.6.x版本后,突然发现与Swagger集成时报错如下
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
原因:因为Springfox使用的路径匹配是基于AntPathMatcher的,而Spring Boot 2.6.X使用的是PathPatternMatcher,该注解可以更改匹配规则
解决方法:
在配置文件(application.yaml)中加入以下配置
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher



