SpringBoot[Failed to start bean ‘documentationPluginsBootstrapper’]

Posted Mr.zhou_Zxy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SpringBoot[Failed to start bean ‘documentationPluginsBootstrapper’]相关的知识,希望对你有一定的参考价值。

SpringBoot[Failed to start bean ‘documentationPluginsBootstrapper’]

1. 添加Swagger依赖

<!--swagger-->
		<dependency>
			<groupId>io.springfox</groupId>
			<artifactId>springfox-swagger2</artifactId>
			<version>2.7.0</version>
		</dependency>
		<!--swagger-->
		<dependency>
			<groupId>io.springfox</groupId>
			<artifactId>springfox-swagger-ui</artifactId>
			<version>2.7.0</version>
		</dependency>

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

以上是关于SpringBoot[Failed to start bean ‘documentationPluginsBootstrapper’]的主要内容,如果未能解决你的问题,请参考以下文章

springboot启动报错:Failed to configure a DataSource

Springboot:解决Failed to load ApplicationContext问题

SpringBoot+WebSocket问题:Failed to register @ServerEndpoint class

SpringBoot启动异常:Reason: Failed to determine a suitable driver class

SpringBoot启动报错Failed to determine a suitable driver class

SpringBoot启动报错Failed to determine a suitable driver class