feature #IAY66T 修改Springboot配置

This commit is contained in:
DaleLee
2024-12-07 23:27:53 +08:00
parent 553e542d11
commit a4f8efd435
5 changed files with 38 additions and 23 deletions

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.yomahub.liteflow.enums.ParseModeEnum;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -99,11 +100,33 @@ public class LiteflowProperty {
//是否启用节点实例ID
private boolean enableNodeInstanceId;
// 是否启用规则缓存
private Boolean enableRuleCache;
// 规则缓存配置
@NestedConfigurationProperty
private RuleCache ruleCache;
// 规则缓存容量
private Integer ruleCacheCapacity;
public static class RuleCache {
// 是否启用规则缓存
private Boolean enabled;
// 规则缓存容量
private Integer capacity;
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public Integer getCapacity() {
return capacity;
}
public void setCapacity(Integer capacity) {
this.capacity = capacity;
}
}
public boolean isEnableMonitorFile() {
return enableMonitorFile;
@@ -337,19 +360,11 @@ public class LiteflowProperty {
this.enableNodeInstanceId = enableNodeInstanceId;
}
public Integer getRuleCacheCapacity() {
return ruleCacheCapacity;
public RuleCache getRuleCache() {
return ruleCache;
}
public void setRuleCacheCapacity(Integer ruleCacheCapacity) {
this.ruleCacheCapacity = ruleCacheCapacity;
}
public Boolean isEnableRuleCache() {
return enableRuleCache;
}
public void setEnableRuleCache(Boolean enableRuleCache) {
this.enableRuleCache = enableRuleCache;
public void setRuleCache(RuleCache ruleCache) {
this.ruleCache = ruleCache;
}
}

View File

@@ -53,8 +53,8 @@ public class LiteflowPropertyAutoConfiguration {
liteflowConfig.setGlobalThreadPoolQueueSize(property.getGlobalThreadPoolQueueSize());
liteflowConfig.setGlobalThreadPoolSize(property.getGlobalThreadPoolSize());
liteflowConfig.setEnableNodeInstanceId(property.isEnableNodeInstanceId());
liteflowConfig.setEnableRuleCache(property.isEnableRuleCache());
liteflowConfig.setRuleCacheCapacity(property.getRuleCacheCapacity());
liteflowConfig.setEnableRuleCache(property.getRuleCache().getEnabled());
liteflowConfig.setRuleCacheCapacity(property.getRuleCache().getCapacity());
return liteflowConfig;
}

View File

@@ -208,14 +208,14 @@
"defaultValue": false
},
{
"name": "liteflow.enable-rule-cache",
"name": "liteflow.rule-cache.enabled",
"type": "java.lang.Boolean",
"description": "Enable rule cache.",
"sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty",
"defaultValue": false
},
{
"name": "liteflow.rule-cache-capacity",
"name": "liteflow.rule-cache.capacity",
"type": "java.lang.Integer",
"description": "Set rule cache capacity.",
"sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty"

View File

@@ -24,5 +24,5 @@ liteflow.global-thread-pool-size=16
liteflow.global-thread-pool-queue-size=512
liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.thread.LiteFlowDefaultGlobalExecutorBuilder
liteflow.enable-node-instance-id=false
liteflow.enable-rule-cache=false
liteflow.rule-cache.enabled=false