mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
1. ruleSource多配置时候中间有空格兼容
This commit is contained in:
@@ -27,6 +27,7 @@ import com.yomahub.liteflow.slot.DefaultContext;
|
||||
import com.yomahub.liteflow.slot.Slot;
|
||||
import com.yomahub.liteflow.spi.holder.ContextCmpInitHolder;
|
||||
import com.yomahub.liteflow.thread.ExecutorHelper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -82,7 +83,8 @@ public class FlowExecutor {
|
||||
//进行id生成器的初始化
|
||||
IdGeneratorHolder.init();
|
||||
|
||||
if (StrUtil.isBlank(liteflowConfig.getRuleSource())) {
|
||||
String ruleSource = liteflowConfig.getRuleSource();
|
||||
if (StrUtil.isBlank(ruleSource)) {
|
||||
//查看有没有Parser的SPI实现
|
||||
//所有的Parser的SPI实现都是以custom形式放入的,且只支持xml形式
|
||||
ServiceLoader<ParserClassNameSpi> loader = ServiceLoader.load(ParserClassNameSpi.class);
|
||||
@@ -100,10 +102,11 @@ public class FlowExecutor {
|
||||
//如果有前缀的,则不需要再进行分割了,说明是一个整体
|
||||
//如果没有前缀,说明是本地文件,可能配置多个,所以需要分割
|
||||
List<String> sourceRulePathList;
|
||||
if (ReUtil.contains(PREFIX_FORMAT_CONFIG_REGEX, liteflowConfig.getRuleSource())){
|
||||
sourceRulePathList = ListUtil.toList(liteflowConfig.getRuleSource());
|
||||
}else{
|
||||
sourceRulePathList = ListUtil.toList(liteflowConfig.getRuleSource().split(",|;"));
|
||||
if (ReUtil.contains(PREFIX_FORMAT_CONFIG_REGEX, ruleSource)) {
|
||||
sourceRulePathList = ListUtil.toList(ruleSource);
|
||||
} else {
|
||||
String afterHandleRuleSource = ruleSource.replace(StrUtil.SPACE, StrUtil.EMPTY);
|
||||
sourceRulePathList = ListUtil.toList(afterHandleRuleSource.split(",|;"));
|
||||
}
|
||||
|
||||
FlowParser parser = null;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SubflowInDifferentConfigELDeclSpringbootTest extends BaseTest {
|
||||
@Test(expected = MultipleParsersException.class)
|
||||
public void testExplicitSubFlow2() {
|
||||
LiteflowConfig config = context.getBean(LiteflowConfig.class);
|
||||
config.setRuleSource("subflow/flow-main.xml,subflow/flow-sub1.xml,subflow/flow-sub2.yml");
|
||||
config.setRuleSource("subflow/flow-main.xml, subflow/flow-sub1.xml,subflow/flow-sub2.yml");
|
||||
flowExecutor.reloadRule();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user