pom.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.ffcs.tsp</groupId>
<artifactId>springboot</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>cn.ffcs.tsp.msa</groupId>
<artifactId>springbootSwagger</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>springbootSwagger</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
<!-- 开发工具:修改java代码无须重新运行 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>
控制层
swagger配置
启动类
访问地址:http://localhost:8080/swagger-ui.html
启动后swagger的ui页面