SpringBoot+SpringCloud+vue+Element开发项目——集成Swagger文档
在pom.xml文件中添加Maven依赖
<!--swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
新建一个config包,并在其下面添加Swagger配置类SwaggerConfig.java。
@Configurable
@EnableSwagger2
public class SwaggerConfig { @Bean
public Docket CreateRestApi(){
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().
apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build();
} public ApiInfo apiInfo(){
return new ApiInfoBuilder().build();
}
}
在application启动类添加
@EnableSwagger2
启动页面测试
浏览器中访问http://localhost:8001/swagger-ui.html#/

SpringBoot+SpringCloud+vue+Element开发项目——集成Swagger文档的更多相关文章
- SpringBoot+SpringCloud+vue+Element开发项目——集成Druid数据源
添加依赖 pom.xml <!--druid--> <dependency> <groupId>com.alibaba</groupId> <ar ...
- SpringBoot+SpringCloud+vue+Element开发项目——集成MyBatis框架
添加mybatis-spring-boot-starter依赖 pox.xml <!--mybatis--> <dependency> <groupId>org.m ...
- SpringBoot+SpringCloud+vue+Element开发项目——搭建开发环境
1.新建一个项目
- SpringBoot+SpringCloud+vue+Element开发项目——数据库设计
1.用户表(sys_user) CREATE TABLE `sys_user` ( `id` ) NOT NULL AUTO_INCREMENT COMMENT '编号', `name` ) NOT ...
- SpringBoot系列:六、集成Swagger文档
本篇开始介绍Api文档Swagger的集成 一.引入maven依赖 <dependency> <groupId>io.springfox</groupId> < ...
- .NET Core基础篇之:集成Swagger文档与自定义Swagger UI
Swagger大家都不陌生,Swagger (OpenAPI) 是一个与编程语言无关的接口规范,用于描述项目中的 REST API.它的出现主要是节约了开发人员编写接口文档的时间,可以根据项目中的注释 ...
- springboot集成swagger文档
//此处省略springboot创建过程 1.引入swagger相关依赖(2个依赖必须版本相同) <dependency> <groupId>io.springfox</ ...
- Spring 5 中函数式web开发中的swagger文档
Spring 5 中一个非常重要的更新就是增加了响应式web开发WebFlux,并且推荐使用函数式风格(RouterFunction和 HandlerFunction)来开发WebFlux.对于之前主 ...
- spring boot集成swagger文档
pom <!-- swagger --> <dependency> <groupId>io.springfox</groupId> <artifa ...
随机推荐
- 012 spring retry重试原理的解析
有点复杂,在后续的章节,将会对其中涉及到的知识点,再分章节进行说明. 1.程序结构 2.@Retryable package com.jun.web.annotation.theory; import ...
- 如何查看Linux服务器是32位还是64位?
使用命令 “getconf LONG_BIT” 如果返回的是32,那么就是32位 如果返回的是64,那么就是64位
- latex怎样生成table字样和caption换行的表格
\begin{table} \caption{\newline The results of running algorithm parallel using MapReduce.} \hline ...
- effictive-python笔记
第一章 用Pythonic方式来思考 1.确认自己所用的python版本(python3) 两个主流的python版本:python2(2020年就不维护) python3(推荐) 多种流行的pyth ...
- [LeetCode] 92. Reverse Linked List II 反向链表II
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1-> ...
- Navicat工具链接 mysql"Access denied for user'root'@'IP'" 用户远程赋值
如题 用Navicat远程连接数据库出现错误 给用户添加权限 连接MySQL mysql -uroot -p: use mysql; 更改权限 使用grant all privileges on来 ...
- Python3 列表list合并的4种方法
方法1: 直接使用"+"号合并列表 aList = [1,2,3] bList = ['www', 'pythontab.com'] cList = aList + bList ...
- javascript高德地图实现点击marker消失marker
javascript高德地图实现点击marker消失marker <pre> var markers = []; var positions = [[120.17718, 30.21772 ...
- python实践项目三:将列表添加到字典
1.创建一个字典,其中键是字符串,描述一个物品,值是一个整型值,说明有多少该物品.例如,字典值{'rope': 1, 'torch': 6, 'gold coin': 42, 'dagger': 1, ...
- 如何在Linux中结合示例使用'cat'和'tac'命令
上一篇我们讲到了cat的使用示例:https://www.cnblogs.com/WeiLian1024/p/11863057.html 本篇我们将继续延续Cat讲讲Tac 本文是我们讲讲Linux技 ...