使用openApi 可以不用添加任何配置

只需要添加如下依赖 -->

<dependency>

<groupId>io.springfox</groupId>

<artifactId>springfox-boot-starter</artifactId>

<version>3.0.0</version>

</dependency>

然后在启动类上添加 @EnableOpenApi 即可

然后浏览器访问地址 Swagger UI 即可(localhost:8080/swagger-ui/index.html)

可能启动报错 在配置文件中 加入

spring:

mvc:

pathmatch:

matching-strategy: ant_path_matcher

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐