Failed to start bean ‘documentationPluginsBootstrapper‘nested exception is java.lang.NullPointerExce

       Springboot 整合swagger

SpringBoot 版本为2.6.2  swagger 版本为2.9.2

导入依赖

<dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
        </dependency>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
        </dependency>

Swagger配置类

@Configuration
@EnableSwagger2         //开启swagger2
public class SwaggerConfig {


}

运行报错

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

解决版本Springboot版本太高降低Springboot版本 降低到2.5.6

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.6</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

运行问题解决

访问swagger-ui.html页 Swagger UIFailed to start bean ‘documentationPluginsBootstrapper‘nested exception is java.lang.NullPointerExcehttp://localhost:8080/swagger-ui.htmlFailed to start bean ‘documentationPluginsBootstrapper‘nested exception is java.lang.NullPointerExce

 

上一篇:java 实现钉钉机器人单人私聊推送钉钉消息(invalidParameter.robotCode.notExsit机器人不存在)


下一篇:java之异常