Spring boot 配置 swagger
1、maven配置包
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
2、配置类
@Configuration
@EnableSwagger2
public class Swagger2Config {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.example.demo")) //这里改成你报controller报名即可
.paths(PathSelectors.any())
.build();
} private ApiInfo apiInfo() { return new ApiInfoBuilder()
.title("RESTful APIs")
.description("RESTFul API 文档")
.version("1.0")
.build();
}
}
3、访问地址: http://localhost:8080/swagger-ui.html
官方使用说明:http://springfox.github.io/springfox/docs/current/
Spring boot 配置 swagger的更多相关文章
- spring boot 配置swagger UI
springboot集成swaggerUI 有这样的需求 1.在每个接口上都增加一个字段: 2.接口文档只展示满足一定条件URL的接口 配置文件 详细看代码 import org.springfram ...
- Spring boot集成Swagger,并配置多个扫描路径
Spring boot集成Swagger,并配置多个扫描路径 1:认识Swagger Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目 ...
- Spring Boot 集成 Swagger,生成接口文档就这么简单!
之前的文章介绍了<推荐一款接口 API 设计神器!>,今天栈长给大家介绍下如何与优秀的 Spring Boot 框架进行集成,简直不能太简单. 你所需具备的基础 告诉你,Spring Bo ...
- spring boot集成swagger,自定义注解,拦截器,xss过滤,异步调用,guava限流,定时任务案例, 发邮件
本文介绍spring boot集成swagger,自定义注解,拦截器,xss过滤,异步调用,定时任务案例 集成swagger--对于做前后端分离的项目,后端只需要提供接口访问,swagger提供了接口 ...
- Spring Boot初识(3)- Spring Boot整合Swagger
一.本文介绍 如果Web项目是完全前后端分离的话(我认为现在完全前后端分离已经是趋势了)一般前端和后端交互都是通过接口的,对接口入参和出参描述的文档就是Mock文档.随着接口数量的增多和参数的个数增加 ...
- spring boot+mybatis+swagger搭建
环境概述 使用的开发工具:idea 2018 3.4 环境:jdk1.8 数据库:MariaDB (10.2.21) 包管理:Maven 3.5 Web容器:Tomcat 8.0 开发机系统:Wind ...
- 【Swagger】可能是目前最好的 Spring Boot 集成 swagger 的方案
[Swagger]可能是目前最好的Spring Boot集成 swagger 的方案 
2301: [HAOI2011]Problem b Time Limit: 50 Sec Memory Limit: 256 MBSubmit: 436 Solved: 187[Submit][S ...
- GOOGLE定位
GOOGLE定位 /// <author>cxg 2018-3-27</author> unit umap; interface uses System.SysUtils, S ...
- MySql_SQLyog+SQL Assistant实现智能提示
相信用过sqlserver+SQL Assistant的同学都知道其智能提示多么方便,但是转到mysql后,无论是使用navicat还是webbench都无法实现较好的智能提示效果, 最终在网上找到使 ...
- Mac OSX 系统目录结构(转)
摘要 在OS X的系统中,不再有Windows用户熟悉的C盘.D盘,这是因为OS X底层是Unix系统,其目录机构符合Unix系统的规范.MAC机器主板使用了Intel主导的EFI标准,硬盘分区格式采 ...
- Android onConfigurationChanged 不执行
自从Android 3.2(API 13),screen size也开始跟着设备的横竖切换而改变. 所以,在AndroidManifest.xml里设置的MiniSdkVersion和 TargetS ...
- 数学图形(2.23)Cylindric sine wave柱面正弦曲线
柱面正弦曲线 #http://www.mathcurve.com/courbes3d/couronnetangentoidale/couronnetangentoidale.shtml vertice ...
- SMTP用户枚举原理简介及相关工具
前言 SMTP是安全测试中比较常见的服务类型,其不安全的配置(未禁用某些命令)会导致用户枚举的问题,这主要是通过SMTP命令进行的.本文将介绍SMTP用户枚举原理以及相关工具. SMTP SMTP命令 ...
- 关于actor-critic,这篇文章写的很好
这篇文章: https://blog.csdn.net/qq_30615903/article/details/80774384 可以好好温习,包括代码,基本看懂了.
- CSS 中的强制换行和禁止换行
强制换行 1.word-break: break-all; 只对英文起作用,以字母作为换行依据. 2.word-wrap: break-word; 只对英文起作 ...