mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-06-10 19:26:54 +08:00
enhancement #I413PU 增加liteflow.enable参数,来标记是否自动装配liteflow
This commit is contained in:
@@ -18,6 +18,11 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
*/
|
||||
public class LiteflowConfig {
|
||||
|
||||
/**
|
||||
* 是否启动liteflow自动装配
|
||||
*/
|
||||
private Boolean enable;
|
||||
|
||||
//流程定义资源地址
|
||||
private String ruleSource;
|
||||
|
||||
@@ -49,6 +54,18 @@ public class LiteflowConfig {
|
||||
//这个参数主要给编码式注册元数据的场景用的,结合FlowBus.addNode一起用
|
||||
private Boolean parseOnStart;
|
||||
|
||||
public Boolean getEnable() {
|
||||
if (ObjectUtil.isNull(enable)){
|
||||
return true;
|
||||
}else{
|
||||
return enable;
|
||||
}
|
||||
}
|
||||
|
||||
public void setEnable(Boolean enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public String getRuleSource() {
|
||||
return ruleSource;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.yomahub.liteflow.util.ExecutorHelper;
|
||||
import com.yomahub.liteflow.util.Shutdown;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -16,8 +17,9 @@ import java.util.concurrent.ExecutorService;
|
||||
* @author justin.xu
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnBean(LiteflowConfig.class)
|
||||
@AutoConfigureAfter({LiteflowPropertyAutoConfiguration.class})
|
||||
@ConditionalOnProperty(prefix = "liteflow", name = "enable", havingValue = "true")
|
||||
@ConditionalOnBean(LiteflowConfig.class)
|
||||
public class LiteflowExecutorAutoConfiguration {
|
||||
|
||||
@Bean("whenExecutors")
|
||||
|
||||
@@ -19,8 +19,9 @@ import org.springframework.context.annotation.Import;
|
||||
* @author Bryan.Zhang
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnBean(LiteflowConfig.class)
|
||||
@AutoConfigureAfter({LiteflowPropertyAutoConfiguration.class})
|
||||
@ConditionalOnBean(LiteflowConfig.class)
|
||||
@ConditionalOnProperty(prefix = "liteflow", name = "enable", havingValue = "true")
|
||||
@Import(SpringAware.class)
|
||||
public class LiteflowMainAutoConfiguration {
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@ConfigurationProperties(prefix = "liteflow", ignoreUnknownFields = true)
|
||||
public class LiteflowProperty {
|
||||
|
||||
//是否装配liteflow
|
||||
private boolean enable;
|
||||
|
||||
//流程定义资源地址
|
||||
private String ruleSource;
|
||||
|
||||
@@ -28,6 +31,14 @@ public class LiteflowProperty {
|
||||
//这个参数主要给编码式注册元数据的场景用的,结合FlowBus.addNode一起用
|
||||
private boolean parseOnStart;
|
||||
|
||||
public boolean isEnable() {
|
||||
return enable;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public String getRuleSource() {
|
||||
return ruleSource;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yomahub.liteflow.springboot;
|
||||
|
||||
import com.yomahub.liteflow.property.LiteflowConfig;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -32,6 +33,7 @@ public class LiteflowPropertyAutoConfiguration {
|
||||
liteflowConfig.setWhenMaxWorkers(property.getWhenMaxWorkers());
|
||||
liteflowConfig.setWhenQueueLimit(property.getWhenQueueLimit());
|
||||
liteflowConfig.setParseOnStart(property.isParseOnStart());
|
||||
liteflowConfig.setEnable(property.isEnable());
|
||||
return liteflowConfig;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
liteflow.enable=true
|
||||
liteflow.rule-source=config/flow.xml
|
||||
liteflow.slot-size=1024
|
||||
liteflow.when-max-wait-seconds=15
|
||||
|
||||
Reference in New Issue
Block a user