当前位置:网站首页>Swagger3 configuration
Swagger3 configuration
2022-07-07 06:08:00 【Tunan】
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
spring.application.name=shop
# ===== Customize swagger To configure ===== #
swagger.enable=true
swagger.application-name= ${spring.application.name}
swagger.application-version=1.0
#swagger.application-description=shop E-commerce platform management backend interface document
swagger.application-description=shop api info
@Component
@EnableOpenApi
@ConfigurationProperties("swagger")
@Data
public class SwaggerConfiguration{
/** * Open or not swagger, The production environment is generally closed , So here we define a variable */
private Boolean enable;
/** * Project application name */
private String applicationName;
/** * Project version information */
private String applicationVersion;
/** * Project description information */
private String applicationDescription;
@Bean
public Docket docket() {
return new Docket(DocumentationType.OAS_30)
.pathMapping("/")
// Define whether to turn on swagger,false To close , It can be controlled by variables , Online closed
.enable(enable)
// To configure api Document meta information
.apiInfo(apiInfo())
// Choose which interfaces to use as swagger Of doc Release
.select()
//apis() Control which interfaces are exposed to swagger,
// RequestHandlerSelectors.any() All exposed
// RequestHandlerSelectors.basePackage("net.xdclass.*") Specify the package location
// withMethodAnnotation(ApiOperation.class) Marked with this note ApiOperation
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title(applicationName)
.description(applicationDescription)
.contact(new Contact(" Tunan ", "111", "111"))
.version(applicationVersion)
.build();
}
}
边栏推荐
- Input of native applet switches between text and password types
- 线性回归
- R language [logic control] [mathematical operation]
- The solution of a simple algebraic problem
- SAP Spartacus checkout 流程的扩展(extend)实现介绍
- CTFshow--常用姿势
- 驱动开发中platform设备驱动架构详解
- Check Point:企业部署零信任网络(ZTNA)的核心要素
- JVM命令之 jstat:查看JVM統計信息
- Understand the deserialization principle of fastjson for generics
猜你喜欢
驱动开发中platform设备驱动架构详解
【SQL实战】一条SQL统计全国各地疫情分布情况
职场经历反馈给初入职场的程序员
Sequential storage of stacks
Jinfo of JVM command: view and modify JVM configuration parameters in real time
Ctfshow-- common posture
[daily training -- Tencent selected 50] 235 Nearest common ancestor of binary search tree
Go language learning notes - Gorm use - native SQL, named parameters, rows, tosql | web framework gin (IX)
[FPGA tutorial case 14] design and implementation of FIR filter based on vivado core
生活中的开销,怎么记账合适
随机推荐
牙齿干细胞的存储问题(未完待续)
搞懂fastjson 对泛型的反序列化原理
老板总问我进展,是不信任我吗?(你觉得呢)
如何提高网站权重
每秒10W次分词搜索,产品经理又提了一个需求!!!(收藏)
Go语学习笔记 - gorm使用 - 原生sql、命名参数、Rows、ToSQL | Web框架Gin(九)
一个简单的代数问题的求解
On the discrimination of "fake death" state of STC single chip microcomputer
On the difference between FPGA and ASIC
[FPGA tutorial case 13] design and implementation of CIC filter based on vivado core
[daily training -- Tencent selected 50] 292 Nim games
PTA 天梯赛练习题集 L2-003 月饼 测试点2,测试点3分析
测试开发基础,教你做一个完整功能的Web平台之环境准备
成为资深IC设计工程师的十个阶段,现在的你在哪个阶段 ?
【日常训练--腾讯精选50】235. 二叉搜索树的最近公共祖先
话说SQLyog欺骗了我!
The boss always asks me about my progress. Don't you trust me? (what do you think)
Bat instruction processing details
C. colonne Swapping [tri + Simulation]
Data storage 3