springBoot Swagger2 接口文档生成
// 生成配置类
package com.irm.jd.config.swagger; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket; /**
* 接口文档自动生成配置
*/
@Configuration
public class Swagger2Config {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.irm.jd.controller"))
.paths(PathSelectors.any())
.build();
} private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("IRM 全局API文档")
.description("IRM 全局API文档,http://irm.jd.com")
.termsOfServiceUrl("http://irm.jd.com")
.version("1.0.0")
.build();
}
} //开启
@SpringBootApplication()
@EnableCaching
@EnableScheduling
@MapperScan("com.irm.jd.mapper")
@EnableAsync
@EnableSwagger2
public class IrmApplication extends SpringBootServletInitializer { @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(IrmApplication.class);
} public static void main(String[] args) {
SpringApplication.run(IrmApplication.class, args);
}
} // 方法上面定义
@PostMapping("/upload")
@ApiOperation(value = "脚本上传")
@ApiImplicitParams({
@ApiImplicitParam(name = "files",value = "上传的文件",type ="file",paramType = "path",required =true)
})
public String uploadScript(List<MultipartFile> files) {
for (MultipartFile file : files) {
System.out.println(file);
}
return null;
}
springBoot Swagger2 接口文档生成的更多相关文章
- springboot+swagger接口文档企业实践(下)
目录 1.引言 2. swagger接口过滤 2.1 按包过滤(package) 2.2 按类注解过滤 2.3 按方法注解过滤 2.4 按分组过滤 2.4.1 定义注解ApiVersion 2.4.2 ...
- 一款对Postman支持较好的接口文档生成工具
最近要编写接口文档给测试和前端看,通过网上查阅资料,也认识了很多款接口文档生成工具,比如易文档.ApiPost.ShowDoc.YApi.EoLinker.DOClever.apizza等,通过对这几 ...
- springboot+swagger接口文档企业实践(上)
目录 1.引言 2.swagger简介 2.1 swagger 介绍 2.2 springfox.swagger与springboot 3. 使用springboot+swagger构建接口文档 3. ...
- SpringBoot: 后台接口文档 - 基于Swagger3
目录 前言:什么是Swagger 起步:(只需简单的3步) 加载依赖 添加注解@EnableOpenApi 启动SpringBoot,访问Swagger后台界面 配置:基于Java的配置 注解:Swa ...
- swagger2 接口文档
1,maven: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www. ...
- php markdown 接口文档生成工具 SummerDoc
2017年9月18日 19:20:22 星期一 因工作需要, 用PHP写了一个管理接口文档的小工具, 下边介绍一下: 浏览器展示的效果: 项目地址:(码云) 例子(http://doc.hearu.t ...
- PCB WebAPI 接口测试工具与接口文档生成
我们自己写WebAPI或调用对方系统提供的WebAPI时,测试WebAPI接口工具用哪些工具呢. 这里将3种WebAPI常用到的工具使用说明.主要是讲对第3种WebApiTestClientWebAp ...
- swagger2 接口文档,整个微服务接口文档
1,因为整个微服务会有好多服务,比如会员服务,支付服务,订单服务,每个服务都集成了swagger 我们在访问的时候,不可能每个服务输入一个url 去访问,看起来很麻烦,所以我们需要在一个页面上集成整个 ...
- SpringFox swagger2 and SpringFox swagger2 UI 接口文档生成与查看
依赖: <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 --> <dependency ...
随机推荐
- 百度地图label样式修正
现象:百度地图 label 宽度为0,文字在标签边框外. 原因:样式冲突,在css中添加下列代码即可: .BMapLabel{ max-width:none; }
- 关于PHP中的 serialize () 和 unserialize () 的使用(即关于PHP中的值与已存储的表示的相互转换)
有时,我们会碰到这样的数据(字符串) a:3:{i:0;s:44:"/Uploads/images/2017-07-21/5971a9a08ad57.png";i:1;s:44:& ...
- centos7 firewall指定IP与端口访问(常用)
1.启动防火墙 systemctl start firewalld.service 2.指定IP与端口 firewall-cmd --permanent --add-rich-rule="r ...
- eclipse 设置字体大小
步骤: 1.打开eclipse,在工具栏里找到 Window -> Perferences,打开如下图: 2.展开General -> Appearance -> Colors an ...
- PAT——1018. 锤子剪刀布
大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示: 现给出两人的交锋记录,请统计双方的胜.平.负次数,并且给出双方分别出什么手势的胜算最大. 输入格式: 输入第1行给出正整数N( ...
- mac使用brew安装配置常见测试工具
Homebrew 包管理工具可以让你安装和更新程序变得更方便,目前在 OS X 系统中最受欢迎的包管理工具是 Homebrew. 安装 在安装 Homebrew 之前,需要将 Xcode Comman ...
- 使用Analyze 和Instruments-Leaks分析解决iOS内存泄露
版权声明:本文为博主原创文章,未经博主允许不得转载. 使用Analyze和Instruments-Leaks分析解决iOS内存泄露 实验的开发环境:Xcode 7 一.使用Product-An ...
- java从mysql读写数据乱码问题
mysql默认使用latin(ISO-8859-1),而java默认使用unicode编码.因此在JAVA中向MYSQL数据库插入数据时,或者读取数据时,都需要先转换一下编码方式. 1.首先查看数据库 ...
- 使用java原生API模拟请求下载文件
/** * * @param urlPath * 下载路径 * @param saveDir * 下载存放目录 * @return 返回下载文件 * @throws Exception */ publ ...
- css代码添加背景图片常用代码
css代码添加背景图片常用代码 1 背景颜色 { font-size: 16px; content: ""; display: block; width: 700px; heigh ...