springboot 2.7.4集成swagger 3.0版本
1、导入依赖
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
2、配置项
2.1启动类添加@EnableOpenApi注解
2.2配置文件中添加
如果不加项目启动会报错
spring.mvc.pathmatch.matching-strategy=ant-path-matcher
3、访问地址
因为swagger3版本做了改动,访问地址变成http://localhost:8080/swagger-ui/index.html
备注如果出现如下图所示报错,参考以下链接,
链接: 如果出现报错,可以参考此链接