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 ...
随机推荐
- 51nod 1515 明辨是非 [并查集+set]
今天cb巨巨突然拿题来问,感觉惊讶又开心,希望他早日康复!!坚持学acm!加油! 题目链接:51nod 1515 明辨是非 [并查集] 1515 明辨是非 题目来源: 原创 基准时间限制:1 秒 空间 ...
- BZOJ1879:[SDOI2009]Bill的挑战(状压DP)
Description Input 本题包含多组数据. 第一行:一个整数T,表示数据的个数. 对于每组数据: 第一行:两个整数,N和K(含义如题目表述). 接下来N行:每行一个字符串. T ≤ ...
- Dropdownlist控件属性 OnSelectedIndexChanged方法不触发
<asp:DropDownList ID="ddlWJLX" runat="server" OnSelectedIndexChanged="dd ...
- Linux学习总结(十三)文本编辑器 vim
vim是vi的升级版,会根据文本属性带色彩显示,具体用法如下: 一般模式 : 1.光标定位: 左右移动一个字符, h l上下移动一个字符, k j左右下上 ,左右在两边,下上在中间这样记光标定位行首 ...
- 播放WAV文件和系统提示音
- supervisord的安装
作用: 用Supervisor管理的进程,当一个进程意外被杀死,supervisort监听到进程死后,会自动将它重新拉起,很方便的做到进程自动恢复的功能,不再需要自己写shell脚本来控制. 安装流程 ...
- [转]表单提交:button input submit 的区别
博客转自于 http://harttle.com/2015/08/03/form-submit.html ,同时自己做了稍微改动 最近项目代码中的表单提交的方式已经百花齐放了,现在用这篇文章来整 ...
- 【luogu P2491 [SDOI2011]消防】 题解
题目链接:https://www.luogu.org/problemnew/show/P2491 题外话: OI一共只有三种题--会的题,不会的题,二分题. 题解: step 1 求树的直径,把树的直 ...
- PL/SQL添加Oracle对象
1.首先用system的身份进入数据库 2.找到user文件夹 3.右击新建用户 在“创建用户”窗口中,输入新用户的名称.口令,默认表空间.临时表空间等 4.赋予新用户权限,赋予其角色权限:conne ...
- Paths with -a does not make sense.
最近开始使用为windows的系统,进行git操作的时候出现了一个小问题. 使用命令: E:\IdeaProjects\mmall>git commit -am 'first commit in ...