springboot3.x 和swagger3整合-爱代码爱编程
目前srping-boot 3.x 无法通过 io.springfox:springfox-boot-starte:3.0.0进行整合,可以更换依赖的来进行解决
版本环境
spring-boot:3.0.4
swagger:3
依赖
在pom.xml的dependencies标签里面添加
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.4</version>
</dependency>
这个也是自动装配的,可以不用配置相关配置,也可以根据需要来配置
启动项目之后,打开页面:http://localhost:8080/swagger-ui/index.html
我的项目的端口是8088所以图上的访问路径不太一样,默认为http://ip:port/swagger-ui/index.html
在swagger3中的api接口地址为localhost:8080/v3/api-docs