diff --git a/liteflow-core/pom.xml b/liteflow-core/pom.xml index 761528291..0c9d49636 100644 --- a/liteflow-core/pom.xml +++ b/liteflow-core/pom.xml @@ -9,7 +9,7 @@ com.yomahub liteflow - 2.2.1 + 2.2.2 diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java index 8cd660266..6e2c87713 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java @@ -19,9 +19,9 @@ import com.yomahub.liteflow.entity.config.Node; public class FlowBus { - private static Map chainMap; + private static Map chainMap = new HashMap<>(); - private static Map nodeMap; + private static Map nodeMap = new HashMap<>(); public static Chain getChain(String id) throws Exception{ if(chainMap == null || chainMap.isEmpty()){ @@ -31,9 +31,6 @@ public class FlowBus { } public static void addChain(String name,Chain chain){ - if(chainMap == null){ - chainMap = new HashMap<>(); - } chainMap.put(name, chain); } @@ -41,10 +38,11 @@ public class FlowBus { return MapUtils.isEmpty(chainMap); } + public static boolean containNode(String nodeId){ + return nodeMap.containsKey(nodeId); + } + public static void addNode(String nodeId, Node node) { - if(nodeMap == null) { - nodeMap = new HashMap<>(); - } nodeMap.put(nodeId, node); } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java index 0f67649d3..474d26be7 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java @@ -63,7 +63,9 @@ public abstract class XmlFlowParser { } }else{ for(Entry componentEntry : ComponentScaner.nodeComponentMap.entrySet()){ - FlowBus.addNode(componentEntry.getKey(), new Node(componentEntry.getKey(), componentEntry.getValue().getClass().getName(), componentEntry.getValue())); + if(!FlowBus.containNode(componentEntry.getKey())){ + FlowBus.addNode(componentEntry.getKey(), new Node(componentEntry.getKey(), componentEntry.getValue().getClass().getName(), componentEntry.getValue())); + } } } diff --git a/liteflow-spring-boot-starter/pom.xml b/liteflow-spring-boot-starter/pom.xml index 4c270e19a..5d855a45f 100644 --- a/liteflow-spring-boot-starter/pom.xml +++ b/liteflow-spring-boot-starter/pom.xml @@ -10,7 +10,7 @@ liteflow com.yomahub - 2.2.1 + 2.2.2 diff --git a/liteflow-test-spring/pom.xml b/liteflow-test-spring/pom.xml index 779ce38ac..33a556fda 100644 --- a/liteflow-test-spring/pom.xml +++ b/liteflow-test-spring/pom.xml @@ -9,7 +9,7 @@ liteflow com.yomahub - 2.2.1 + 2.2.2 diff --git a/liteflow-test-springboot/pom.xml b/liteflow-test-springboot/pom.xml index 974e5d3cc..0e8590192 100644 --- a/liteflow-test-springboot/pom.xml +++ b/liteflow-test-springboot/pom.xml @@ -9,7 +9,7 @@ liteflow com.yomahub - 2.2.1 + 2.2.2 diff --git a/pom.xml b/pom.xml index d8aab448b..98eae7edf 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.yomahub liteflow pom - 2.2.1 + 2.2.2 liteflow a lightweight and practical micro-process framework https://github.com/bryan31/liteflow