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 ...
随机推荐
- WAL streaming (max_wal_senders > 0) requires wal_level "replica" or "logical"
初次使用pg的11版本,执行以下操作修改归wal_level设置: alter system set set wal_level='minimal'; 尝试重启pg,发现重启失败,并报错: waiti ...
- typescript - 3.函数
(1)函数的定义 ## 函数声明法 // function run():string{ // return 'run'; // } //错误写法,返回类型错误 // function run():st ...
- React中跨域问题的完美解决方案
针对react版本^16.6.0有多种解决方案 方案一:package.json中加上proxy代理配置 在packge.json加入 "proxy": "http:// ...
- 在CentOS 7中 使用 Nginx 反代 .Net Core
很久没弄 .Net Core 了,然后忽然发现Windows自带的 Hyper-V 虚拟机貌似挺好用的 .Net Core 之前都是用 Jexus 来做服务器,忽然想用下Nginx来试试 1.在 Ce ...
- 【视频开发】【计算机视觉】doppia编译之三:编译安装opencv库
这里我介绍2种方法 (1)利用别人写好的脚本编译,相对来说省力一点 上Github下载别人写好的脚本文件,网址 https://github.com/jayrambhia/Install-OpenC ...
- vscode添加vue文件模板
文件->首选项->用户代码片段->输入vue,打开vue.json 添加模板json "Print to console": { "prefix&quo ...
- 设置程序崩溃时产生 core 文件的配置
/* 不限制 core 文件的大小 */ ulimit -c unlimited /* 使用 pid 进行命名 */ echo " > /proc/sys/kernel/core_us ...
- Miller_Rabin算法_单个素数检测_启发式算法
/** Miller_Rabin 算法进行素数测试 快速判断一个<2^63的数是不是素数,主要是根据费马小定理 */ #define ll __int128 ; ///随机化算法判定次数 ll ...
- Hack The Box Web Pentest 2017
[20 Points] Lernaean [by [Arrexel] 问题描述: Your target is not very good with computers. Try and guess ...
- 【知识总结】Polya 定理
我第一次听说 Polya 原理是 NOIP2017 以前,但我觉得太难想着以后再学: NOIP2018 以前我觉得会考这玩意,下定决心学,后来咕了: WC2019 以前我觉得会考这玩意,下定决心学,后 ...