mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
update 配置转移到 yml 文件 统一管理
This commit is contained in:
@ -21,32 +21,54 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* Swagger2的接口配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2WebMvc
|
||||
@EnableKnife4j
|
||||
public class SwaggerConfig
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
public class SwaggerConfig {
|
||||
/**
|
||||
* 系统基础配置
|
||||
*/
|
||||
@Autowired
|
||||
private RuoYiConfig ruoyiConfig;
|
||||
|
||||
/** 是否开启swagger */
|
||||
/**
|
||||
* 是否开启swagger
|
||||
*/
|
||||
@Value("${swagger.enabled}")
|
||||
private boolean enabled;
|
||||
|
||||
/** 设置请求的统一前缀 */
|
||||
/**
|
||||
* 设置请求的统一前缀
|
||||
*/
|
||||
@Value("${swagger.pathMapping}")
|
||||
private String pathMapping;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@Value("${swagger.title}")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Value("${swagger.description}")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
@Value("${swagger.version}")
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 创建API
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi()
|
||||
{
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
// 是否启用Swagger
|
||||
.enable(enabled)
|
||||
@ -70,8 +92,7 @@ public class SwaggerConfig
|
||||
/**
|
||||
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||
*/
|
||||
private List<ApiKey> securitySchemes()
|
||||
{
|
||||
private List<ApiKey> securitySchemes() {
|
||||
List<ApiKey> apiKeyList = new ArrayList<ApiKey>();
|
||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
|
||||
return apiKeyList;
|
||||
@ -80,8 +101,7 @@ public class SwaggerConfig
|
||||
/**
|
||||
* 安全上下文
|
||||
*/
|
||||
private List<SecurityContext> securityContexts()
|
||||
{
|
||||
private List<SecurityContext> securityContexts() {
|
||||
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||
securityContexts.add(
|
||||
SecurityContext.builder()
|
||||
@ -94,8 +114,7 @@ public class SwaggerConfig
|
||||
/**
|
||||
* 默认的安全上引用
|
||||
*/
|
||||
private List<SecurityReference> defaultAuth()
|
||||
{
|
||||
private List<SecurityReference> defaultAuth() {
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
@ -107,18 +126,17 @@ public class SwaggerConfig
|
||||
/**
|
||||
* 添加摘要信息
|
||||
*/
|
||||
private ApiInfo apiInfo()
|
||||
{
|
||||
private ApiInfo apiInfo() {
|
||||
// 用ApiInfoBuilder进行定制
|
||||
return new ApiInfoBuilder()
|
||||
// 设置标题
|
||||
.title("标题:若依管理系统_接口文档")
|
||||
.title(title)
|
||||
// 描述
|
||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||
.description(description)
|
||||
// 作者信息
|
||||
.contact(new Contact(ruoyiConfig.getName(), null, null))
|
||||
// 版本
|
||||
.version("版本号:" + ruoyiConfig.getVersion())
|
||||
.version(version)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -119,6 +119,7 @@ token:
|
||||
# MyBatis配置
|
||||
# https://baomidou.com/config/
|
||||
mybatis-plus:
|
||||
mapperPackage: com.ruoyi.**.mapper
|
||||
# 对应的 XML 文件位置
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 实体扫描,多个package用逗号或者分号分隔
|
||||
@ -217,6 +218,12 @@ swagger:
|
||||
enabled: true
|
||||
# 请求前缀
|
||||
pathMapping: /dev-api
|
||||
# 标题
|
||||
title: '标题:RuoYi-Vue-Plus后台管理系统_接口文档'
|
||||
# 描述
|
||||
description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...'
|
||||
# 版本
|
||||
version: '版本号: ${ruoyi-vue-plus.version}'
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
@ -227,7 +234,26 @@ xss:
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
threadPoolConfig:
|
||||
# 是否开启线程池
|
||||
enabled: false
|
||||
# 核心线程池大小
|
||||
corePoolSize: 8
|
||||
# 最大可创建的线程数
|
||||
maxPoolSize: 16
|
||||
# 队列最大长度
|
||||
queueCapacity: 128
|
||||
# 线程池维护线程所允许的空闲时间
|
||||
keepAliveSeconds: 300
|
||||
# 线程池对拒绝任务(无线程可用)的处理策略
|
||||
# CallerRunsPolicy 等待
|
||||
# DiscardOldestPolicy 放弃最旧的
|
||||
# DiscardPolicy 丢弃
|
||||
# AbortPolicy 中止
|
||||
rejectedExecutionHandler: CallerRunsPolicy
|
||||
|
||||
feign:
|
||||
package: com.ruoyi.**.feign
|
||||
# 开启压缩
|
||||
compression:
|
||||
request:
|
||||
|
Reference in New Issue
Block a user