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