Springfox报错documentationPluginsBootstrapper

Springboot 整合 swagger 使用的 springfox 报错

经排查为版本bug

报错: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException

正常情况下, 导入相关依赖, 然后配置配置类, 接口加上注解就可以直接使用

相关swagger依赖:

1
2
3
4
5
6
7
8
9
10
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>

而当springboot 2.6.0与springfox-swagger的3.0.0一起使用时, 就会报错导致项目无法正常启动.


暂时解决方法为更改为可以使用的版本:

springboot 2.5.6/2.5.7

1
2
3
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.6</version>

springfox-swagger2 2.9.2

springfox-swagger-ui 2.9.2

1
2
3
4
5
6
7
8
9
10
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
Author: klenq
Link: https://klenq.github.io/2021/11/26/Springfox报错documentationPluginsBootstrapper/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.