报错原文:
当spring-boot版本从2.5.x升级到2.6.x或者2.7.x时,运行项目时报错:org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
报错原因:
因为2.5.x版本的spring-boot路径匹配是基于path_pattern_matcher的,而spring-boot 2.6.X和2.7.x使用的是ant_path_matcher。
如何解决:
在配置文件(application.yaml)的spring配置里,添加如下配置:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
或者在applicatrion.properties配置文件里添加spring.mvc.pathmatch.matching-strategy= ANT_PATH_MATCHER
重新启动程序即可。