当前位置:网站首页>knife4j配置使用直接拷贝即可
knife4j配置使用直接拷贝即可
2022-06-10 19:21:00 【贺贺学编程】
废话我就不多说了,直接上maven依赖
<!-- knife4j接口文档 -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
然后写一个配置类Knife4jConfig,为了避免导错包,把包也给你们了
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class Knife4jConfig {
@Bean(value = "defaultApi2")
public Docket defaultApi2() {
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(new ApiInfoBuilder()
.title("xxx接口说明")
.description("xxx接口描述")
.termsOfServiceUrl("http://www.xx.com/")
.contact(new Contact("xxx公司", "http://xxx.com/", "[email protected]"))
.version("1.0")
.build())
//分组名称
.groupName("2.X版本")
.select()
//这里指定Controller扫描包路径
.apis(RequestHandlerSelectors.basePackage("com.xxx.controller"))
.paths(PathSelectors.any())
.build();
return docket;
}
}
运行项目访问 http://localhost:8080/doc.html
边栏推荐
- Problem with makefile: unable to detect file updates
- Spark ShuffleManager
- 推开混合云市场大门,Lenovo xCloud的破局之道
- Fs2117 boost IC output 5v2.4a synchronous rectification
- C (pointer 02)
- 2022.05.23 (lc_300_longest increment subsequence)
- Tidb - quick start, cluster setup
- Batch detection of specified ports of different URLs (py script)
- How to apply VR panorama in home decoration? Experience the real home decoration effect
- Mixin -- mixed
猜你喜欢

First batch! Sinomenine has passed CWPP capability assessment and inspection of Xintong Institute

Zabbix_ Monitoring ssh/crond Service - wechat alarm

KP522201A采用 SOT23-6 封装的 4.5V 至 17V 输入、2A 输出、600kHz 同步降压转换器

I drew several exquisite charts with plotly, which turned out to be beautiful!!

20192407 2021-2022-2 《网络与系统攻防技术》实验八实验报告

Easily learn pytoch full convolution neural network to realize expression recognition

Rotated Sorted Array旋转排序数组相关题

RT-Thread Smart Win10 64位下编译环境的搭建

How to add aggregation hotspots in VR panorama? How to add a content module?

localhost和127.0.0.1的区别?
随机推荐
用一个性能提升了666倍的小案例说明在TiDB中正确使用索引的重要性
Fs4521 constant voltage linear charging IC
云原生社区 大佬博客
Trilogy to solve the problem of playing chess first and then
HW blue team intermediate interview reply
NFS network mount to create server image
FS4100 锂电充电管理IC输入12V给8.4V充电IC
SBC chip 35584 data manual pre regulator translation
Deep understanding of lightgbm
Is it safe to open a futures account online? How to avoid being cheated?
仅需三步学会使用低代码ThingJS与森数据DIX数据对接
uni-app自定义导航
One question to explain the past and present life of dynamic planning
C (pointer 02)
PDU session flow
2022 年 DevOps 路线图|Medium
2022.05.26 (lc_1143_longest common subsequence)
How to increase the monthly salary of software testing from 10K to 30K? Only automated testing can do it
nodejs: 官方文档3 dgram Stream
移动端渲染原理浅析