swagger3整合knife4j
时间: 2023-09-24 21:12:54 浏览: 155
Swagger 3与Knife4j整合的步骤如下:
首先,您需要在Maven依赖中添加以下两个依赖:
```
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
```
接下来,您需要引入Swagger-UI的页面美化依赖(可选):
```
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.8.5</version>
</dependency>
```
然后,您需要创建一个配置类,用于配置Swagger和Knife4j的相关信息。
最后,您可以使用Swagger的注解来定义API文档。
请注意,如果您使用的是Spring Boot的版本大于2.3,则还需要引入javax.validation的依赖:
```
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
```
这样,您就完成了Swagger 3与Knife4j的整合。通过访问Swagger的UI页面,您可以查看和测试API文档。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [Swagger 3集成knife4j(第三方Swagger-UI插件)](https://blog.csdn.net/qq_38974638/article/details/120840743)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *2* [Spring Boot整合Swagger3.0及Knife4j](https://blog.csdn.net/cristianoxm/article/details/128329539)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *3* [Swagger 3 整合 knife4j](https://blog.csdn.net/m0_52462015/article/details/120952625)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文