?????? 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 UIhttp://localhost:8080/swagger-ui.html
?
|