SpringBoot+SpringCloud+vue+Element开发项目——集成Swagger文档
2024-08-26 09:07:27
在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#/
最新文章
- iOS开发之App间账号共享与SDK封装
- JavaScript学习笔记-数组
- 关于update set from where
- linux系统:rm-rf执行以后,怎么办?我来教你恢复文件。
- Snagit 12 – 功能强的老牌截图软件
- linux下改变文件的字符编码
- spring maven pom
- C++模板:二分查找
- HDU 3032 Nim or not Nim? (sg函数求解)
- Composite C1是一个.Net平台上开源专业的CMS开源项目
- git &; github 同步文件
- Ubuntu 下wifi掉线
- zabbix3.4.7 饼图显示问题
- cubieboard网络设置
- 分页组件vue和jsp版本
- B-spline Curves 学习之B样条曲线的导数(8)
- C#里面的枚举与位或运算符 一个枚举变量存入多个值
- AOP拦截日志报错llegalStateException: It is illegal to call this method if the current request is not in asynchronous mode
- 【Huffman树贪心+优先队列】POJ3253-Fence Repair
- 【转】使用Jmeter对Websocket进行压力测试
热门文章
- beyond compare解决特殊字符无法输出、多sheet页无法对比以及文件太大超出系统内存问题的Excel转txt脚本
- ERROR: source database ";template1"; is being accessed by other users
- MSYS2 编译环境配置
- hibernate的load和get有什么作用
- postman做接口测试 application/x-www-form-urlencoded 格式与json格式互转
- Python - Django - 序列化
- [LeetCode] 200. Number of Islands 岛屿的数量
- [LeetCode] 354. Russian Doll Envelopes 俄罗斯套娃信封
- mongodb 切换wiredtiger
- Python:self理解