// 生成配置类
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 接口文档生成的更多相关文章

  1. springboot+swagger接口文档企业实践(下)

    目录 1.引言 2. swagger接口过滤 2.1 按包过滤(package) 2.2 按类注解过滤 2.3 按方法注解过滤 2.4 按分组过滤 2.4.1 定义注解ApiVersion 2.4.2 ...

  2. 一款对Postman支持较好的接口文档生成工具

    最近要编写接口文档给测试和前端看,通过网上查阅资料,也认识了很多款接口文档生成工具,比如易文档.ApiPost.ShowDoc.YApi.EoLinker.DOClever.apizza等,通过对这几 ...

  3. springboot+swagger接口文档企业实践(上)

    目录 1.引言 2.swagger简介 2.1 swagger 介绍 2.2 springfox.swagger与springboot 3. 使用springboot+swagger构建接口文档 3. ...

  4. SpringBoot: 后台接口文档 - 基于Swagger3

    目录 前言:什么是Swagger 起步:(只需简单的3步) 加载依赖 添加注解@EnableOpenApi 启动SpringBoot,访问Swagger后台界面 配置:基于Java的配置 注解:Swa ...

  5. swagger2 接口文档

    1,maven: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www. ...

  6. php markdown 接口文档生成工具 SummerDoc

    2017年9月18日 19:20:22 星期一 因工作需要, 用PHP写了一个管理接口文档的小工具, 下边介绍一下: 浏览器展示的效果: 项目地址:(码云) 例子(http://doc.hearu.t ...

  7. PCB WebAPI 接口测试工具与接口文档生成

    我们自己写WebAPI或调用对方系统提供的WebAPI时,测试WebAPI接口工具用哪些工具呢. 这里将3种WebAPI常用到的工具使用说明.主要是讲对第3种WebApiTestClientWebAp ...

  8. swagger2 接口文档,整个微服务接口文档

    1,因为整个微服务会有好多服务,比如会员服务,支付服务,订单服务,每个服务都集成了swagger 我们在访问的时候,不可能每个服务输入一个url 去访问,看起来很麻烦,所以我们需要在一个页面上集成整个 ...

  9. SpringFox swagger2 and SpringFox swagger2 UI 接口文档生成与查看

    依赖: <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 --> <dependency ...

随机推荐

  1. Django 玩转API

    现在,让我们进入Python的交互式shell,玩转这些Django提供给你的API. 使用如下命令来调用Python shell: $ python manage.py shell 我们使用上述命令 ...

  2. UIView 动画 依赖与 CALayer的证据

    - (nullable id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event Layer: -(voi ...

  3. java之静态方法,静态变量

    在自动化测试中,经常会用到静态方法和静态变量.那么什么是静态方法和静态变量呢?以及在什么情况下使用呢?下面来说一说 静态方法和静态变量是使用公共内存空间的,就是说所有对象都可以直接引用,不需要创建对象 ...

  4. EF Core 2.0中Transaction事务会对DbContext底层创建和关闭数据库连接的行为有所影响

    数据库 我们先在SQL Server数据库中建立一个Book表: CREATE TABLE [dbo].[Book]( ,) NOT NULL, ) NULL, ) NULL, ) NULL, [Cr ...

  5. EF Core 2.1 中的 Eager loading、Explicit loading和LazyLoading (转自MSDN)

    Entity Framework Core allows you to use the navigation properties in your model to load related enti ...

  6. ubuntu software center和新立得

    打开软件库,可以搜索或在终端输入software-center如果没有,可能没有安装软件库,可以在终端安装:sudo apt-get install software-center[注意全部小写]使用 ...

  7. UE4 Navmesh 室内导航设置

    我用的UE版本是4.14.1   系统:win10 64 前不久给样板房里面做了一个扫地机器人,导航设置让我头大了很久,度娘也没有用,最后在谷哥上有所感悟,现在给出本人的设置过程和解决方案. 一开始拖 ...

  8. [ZJOI2009]假期的宿舍(二分图匹配)

    题目描述 学校放假了 · · · · · · 有些同学回家了,而有些同学则有以前的好朋友来探访,那么住宿就是一个问题.比如 A 和 B 都是学校的学生,A 要回家,而 C 来看B,C 与 A 不认识. ...

  9. hdu_4465_Candy

    LazyChild is a lazy child who likes candy very much. Despite being very young, he has two large cand ...

  10. h5禁用手机input点击放大

    最近项目做的是h5的手机移动端,在用苹果浏览器测试时,弹出框输入信息会自动拉伸屏幕,并且不会像安卓一样回来. 网上查找说设置浏览器自适应头,但是并没有效果, <meta name="v ...