作者:她能让你微笑衙 | 来源:互联网 | 2023-06-08 14:53
SpringBoot[Failed to start bean ‘documentationPluginsBootstrapper’] 1. 添加Swagger依赖 io.springfox springfox-swagger2 2.7.0 io.springfox springfox-swagger-ui 2.7.0
2. 添加Swagger配置[application.yml] springfox:documentation:swagger-ui:enabled: true
3. 启动即报错 org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper';nested exception is java.lang.NullPointerException
4.查找原因 根据查找,很多提到是版本的问题,于是换了不同版本的Swagger依赖 还有的说是因为swagger依赖google的guava的版本问题 经过尝试后,并没有解决我的问题 最后发现了如下这个博客
最终解决问题参考来源
5. 解决问题 因为我使用的SpringBoot的版本是2.6.4,根据上述博主的说法,是因为SpringBoot中SpringMVC的默认策略从ANT_PATH_MATCHER 改成了PATH_PATTERN_PARSER所以就有错误了,解决方案如下: 在application.yml配置文件中添加如下: spring:mvc:pathmatch:matching-strategy: ant_path_matcher