diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/AbstractServiceConfiguration.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/AbstractServiceConfiguration.java index 03aca9e486b..2b4c45e3937 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/AbstractServiceConfiguration.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/AbstractServiceConfiguration.java @@ -12,11 +12,11 @@ */ package org.flowable.common.engine.impl; +import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.List; import java.util.Map; -import java.util.TreeSet; import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher; import org.flowable.common.engine.api.delegate.event.FlowableEventListener; @@ -75,7 +75,7 @@ public void setConfigurators(Collection> configurators) { initConfigurators(); this.configurators.clear(); if (configurators != null) { - this.configurators.addAll(configurators); + this.configurators.addAll(configurators.stream().sorted(Comparator.comparingInt(ServiceConfigurator::getPriority)).toList()); } } @@ -87,7 +87,7 @@ public AbstractServiceConfiguration addConfigurator(ServiceConfigurator co protected void initConfigurators() { if (this.configurators == null) { - this.configurators = new TreeSet<>(Comparator.comparingInt(ServiceConfigurator::getPriority)); + this.configurators = new ArrayList<>(); } }