build: swagger
This commit is contained in:
31
src/main/java/com/metis/config/SwaggerConfig.java
Normal file
31
src/main/java/com/metis/config/SwaggerConfig.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.metis.config;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Contact;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.info.License;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
public OpenAPI customOpenAPI() {
|
||||
Contact contact = new Contact();
|
||||
contact.setEmail("wlddhj@163.com");
|
||||
contact.setName("huangjian");
|
||||
contact.setUrl("http://doc.xiaominfo.com");
|
||||
return new OpenAPI()
|
||||
// 增加swagger授权请求头配置
|
||||
// .components(new Components().addSecuritySchemes(CommonConstant.X_ACCESS_TOKEN,
|
||||
// new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme(CommonConstant.X_ACCESS_TOKEN)))
|
||||
.info(new Info()
|
||||
.title("Shi9 后台服务API接口文档")
|
||||
.version("1.0")
|
||||
.contact(contact)
|
||||
.description("Knife4j集成springdoc-openapi示例")
|
||||
.termsOfService("http://doc.xiaominfo.com")
|
||||
.license(new License().name("Apache 2.0")
|
||||
.url("http://www.apache.org/licenses/LICENSE-2.0.html")));
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,30 @@ mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
cache-enabled: false
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
tags-sorter: alpha
|
||||
group-configs:
|
||||
- group: bis
|
||||
display-name: "业务接口文档"
|
||||
paths-to-match: '/**'
|
||||
packages-to-scan: org.shi9.module.bis
|
||||
- group: system
|
||||
display-name: "业务接口文档"
|
||||
paths-to-match: '/**'
|
||||
packages-to-scan: com.metis.controller
|
||||
default-flat-param-object: true
|
||||
knife4j:
|
||||
# 开启增强配置
|
||||
enable: true
|
||||
# 开启生产环境屏蔽(如果是生产环境,需要把下面配置设置true)
|
||||
# production: true
|
||||
setting:
|
||||
language: zh_cn
|
||||
swagger-model-name: 实体类列表
|
||||
basic: # 开始授权认证
|
||||
enable: true
|
||||
username: admin
|
||||
password: 123456
|
||||
|
||||
Reference in New Issue
Block a user