前几天在和青戈做项目时听到这个章节,整合swagger的时候一直无法解决这个问题。
搜索了很多方法,今天终于成功了。
首先需要引入pom.xml的dependency
<!--swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
然后就是aplication.yml中加入
spring:
mvc:
pathmatch:
atching-strategy: ant_path_matcher
最后在项目启动项加入
@EnableWebMvc 非常重要!
最后访问localhost:9090/swagger-ui/index.html就好啦。