什么是swagger , swagger 用来干什么 。
swagger 的出现是因为前端与后端的需求而存在的。Java 开发分为后端的开发 前端的开发 开发更多的 离不开接口 从而出现了很多的接口测试。Swagger 主要是为了接口测试开发而引用的。
Swagger 主要方便开发 人员开发测试方便而出现的。
首先: Swagger 需要引入jar 包 swagger2 和swagger—ui 都是springfox 下面的。关于jar 可以从mave 仓库现在jar 包。
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
启动springboot 项目就可以 引入依赖就可以访问
http://localhost:8080/swagger-ui.html