导入依赖:
<!--整合Swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
编写配置类SwaggerConfig
package com.fdw.springbootstudy.config;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2//开启swagger2
public class SwaggerConfig {
}
打开页面:
http://localhost:9999/swagger-ui.html
配置多个API 分组
实体类Model文档
实体类注释
接口方法文档
接口测试