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 ...
随机推荐
- Perl中的字符串操作函数
1.$position = index(string,substring,skipchars): 该函数返回子串substring在字符串string中的位置,如果不存在,则返回-1:参数skipch ...
- luogu3368树状数组模板2
题目链接:https://www.luogu.org/problemnew/show/P3368 题意:与模板1不同的是这题的操作是树状数组并不在行的区间更新和单点查找,如果按照模板1那样写肯定会T. ...
- Maven的一些基本命令
mvn -v 查看maven版本 compile 编译 test 测试 package 打包 clean 删除target install 安装jar包到项目 使用 archetype 创建目录文件 ...
- js秒换成天时分
js秒换成天时分 function timeStamp( second_time ){ var time = parseInt(second_time) + "秒"; if( pa ...
- private、protected、public和internal的区别
private是完全私有的,只有在类自己里面可以调用,在类的外部和子类都不能调用,子类也不能继承父类的private的属性和方法. protected虽然可以被外界看到,但外界却不能调用,只有自己及自 ...
- js的垃圾回收机制
Js具有自动垃圾回收机制.垃圾收集器会按照固定的时间间隔周期性的执行. JS中最常见的垃圾回收方式是标记清除. 工作原理:是当变量进入环境时,将这个变量标记为“进入环境”.当变量离开环境时,则将其标记 ...
- OS--lab0+lab1+lab4+lab5+lab6+lab7
URL:https://github.com/Chasssser/MytestOR(Linux) git clone https://github.com/Chasssser/Mytest
- Const 关键字详解
const 标识符 在c++中作为常量修饰符 用来修饰 函数 变量 指针 const 修饰的变量不可以改变值 const 在修饰指针的时候 const 标识符出现在*的左边表示 指向的变量为常量不能 ...
- jQuery中的easyui
一,easyui---datagrid绑定数据的简单测试: 1.数据库中的UserInfo表及数据测试: 2.DAL层: //分页,模糊查询(pageNum-1)*pageSize+1----从第几条 ...
- python开发的学生管理系统
python开发的学生管理系统(基础版) #定义一个函数,显示可以使用的功能列表给用户 def showInfo(): print("-"*30) print(" 学生管 ...