ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper‘;
Spring boot reports the following errors:
org.springframework.context.applicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java. lang.NullPointerException
After testing for a long time, it is found that the reason for swagger2:
Version 3.0.0 was originally used:
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
It is said that:
Reason: This is because Springfox uses path matching based on AntPathMatcher, while Spring Boot 2.6.X uses PathPatternMatcher.
Solution: Configure in application.properties: spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
After testing, no error was reported, but the search access http://localhost:8080/swagger-ui.html has 404
Final solution:
Switch the version of swagger2 and swaggerui to version 2.9.2
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
If it does not work like me, just add the following code in application.properties:
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
Problem solved!
Read More:
- Springboot Integrate Swagger2 Error: Failed to start bean ‘documentationPluginsBootstrapper‘;
- [Solved] Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPointerEx
- [Solved] Springboot integrate swagger error: Failed to start bean ‘documentationPluginsBootstrapper‘
- How to Solve Swagger error: IllegalStateException
- [Solved] swagger Docmentation Access Error: Illegal DefaultValue 1024 for parameter type integer, java.lang.NumberFormatException
- [Solved] Springboot Error: swagger-UI/index.html Access Error 404
- Failed to start bean ‘documentationPluginsBootstrapper‘ [How to Solve]
- Springboot error about swagger startup [How to Solve]
- [Siolved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘webMvcObject
- Springboot2.6X version integrate knife4j error [How to Solve]
- [Solved] Spring Cloud Use Ribbon Error: No instances available for XXX
- spring cloud 2020 gateway Error 503 [How to Solve]
- [Solved] Seata Error: endpoint format should like ip:port
- How to Solve Spring integrate Seata startup error
- How to Solve Swagger error: typeerror: failed to fetch
- Caused by: java.lang.IllegalStateException (How to Fix)
- [Solved] Mybatis add dependencies Error: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration.
- Error resolving template [index], template might not exist
- [Solved] spring boot integrated PageHelper Error
- [Solved] Springboot integrate swagger error: failed to start bean ‘documentationpluginsbootstrapper‘