做优惠卷网站,网站建设数据库怎么传送,客户关系管理案例,wordpress采集审核Swagger
简介
号称世界上最流行的API框架#xff1b;Restful API 文档在线生成工具 — API文档与API定义同步更新直接运行#xff0c;可以在线测试 API 接口#xff1b;支持各种语言#xff1b;#xff08;Java#xff0c;PHP…#xff09;
官网
Spring Boot 集…Swagger
简介
号称世界上最流行的API框架Restful API 文档在线生成工具 — API文档与API定义同步更新直接运行可以在线测试 API 接口支持各种语言JavaPHP…
官网
Spring Boot 集成 Swagger 在项目中使用 Swagger 需要Springfox swagger 2swagger ui 1、新建一个Spring Boot web 项目
2、导入相关依赖
!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 --
dependencygroupIdio.springfox/groupIdartifactIdspringfox-swagger2/artifactIdversion2.9.2/version
/dependency!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui --
dependencygroupIdio.springfox/groupIdartifactIdspringfox-swagger-ui/artifactIdversion2.9.2/version
/dependency3、HelloWorld
4、配置 Swagger Congfig
Configuration
EnableSwagger2 // 开启 Swagger 2
public class SwaggerConfig {
}5、访问页面http://localhost:8080/swagger-ui.html
配置 Swagger
Swagger 的 bean实例 Docket;
Configuration
EnableSwagger2 // 开启 Swagger 2
public class SwaggerConfig {// 配置了 Swagger 的 Docket 的bean实例Beanpublic Docket docket(){return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo());}// 配置 Swagger 信息public ApiInfo apiInfo(){// 作者信息Contact contact new Contact(小贱, http://sword-man.cn/index.html, xiaojian2436163.com);return new ApiInfo(小贱的Swagger API文档,但行好事莫问前程,1.0,http://sword-man.cn/index.html,contact,Apache 2.0,http://www.apache.org/licenses/LICENSE-2.0,new ArrayList());}
}