a. 问题描述:Failed to start bean ‘documentationPluginsBootstrapper'
b. 问题原因:
使用spring-boot-starter-parent:2.6.x
与springfox-boot-starter:3.0.0
生成接口文档过程,出现容器刷新失败,应用无法启动问题,显示Failed to start bean 'documentationPluginsBootstrapper'
,报出空指针异常!原因在于,spring boot
已经改用PathPatternParser
进行路径匹配解析,而springfox-boot-starter
依然使用旧的AntPathMatcher
,最终导致documentationPluginsBootstrapper
bean创建失败。
c. 解决方法:
在配置application.properties
中将路径匹配策略设置
修改即可!
注意: 如果你还使用了
spring-boot-starter-actuator
,以下设置将不能生效,具体不知道什么鬼原因,费了好大劲,依赖一个一个测出来的!
spring.mvc.pathmatch.matching-strategy=ant_path_matcher