diff --git a/starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/ConfigurablePropertiesLoader.java b/starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/ConfigurablePropertiesLoader.java index 6e2223a5a29b099be79dc633cc2077c17f115f1e..b2636467719f38e02bfa34cb6e0bbf37a0ff07b6 100644 --- a/starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/ConfigurablePropertiesLoader.java +++ b/starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/ConfigurablePropertiesLoader.java @@ -4,7 +4,6 @@ import com.ctrip.framework.apollo.Config; import com.ctrip.framework.apollo.ConfigService; import com.schbrain.common.util.properties.OrderedMapPropertySource; import com.schbrain.common.util.support.ConfigurableProperties; -import com.schbrain.framework.autoconfigure.apollo.event.ConcurrentEventMulticaster; import com.schbrain.framework.autoconfigure.apollo.event.ConfigLoadedEvent; import com.schbrain.framework.autoconfigure.apollo.event.listener.ConfigLoadedEventListener; import com.schbrain.framework.autoconfigure.apollo.properties.ApolloProperties; @@ -14,6 +13,8 @@ import org.apache.commons.logging.Log; import org.springframework.boot.SpringApplication; import org.springframework.boot.logging.DeferredLogFactory; import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ApplicationEventMulticaster; +import org.springframework.context.event.SimpleApplicationEventMulticaster; import org.springframework.core.env.CompositePropertySource; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.util.ClassUtils; @@ -50,7 +51,7 @@ class ConfigurablePropertiesLoader { return; } - ConcurrentEventMulticaster eventMulticaster = createEventMulticaster(application.getListeners()); + ApplicationEventMulticaster eventMulticaster = createEventMulticaster(application.getListeners()); ApolloProperties apolloProperties = ApolloProperties.get(environment); @@ -85,8 +86,8 @@ class ConfigurablePropertiesLoader { return new ConfigLoadedEvent(environment, deferredLogFactory, propertySource, boundProperties, application); } - private ConcurrentEventMulticaster createEventMulticaster(Set> listeners) { - ConcurrentEventMulticaster eventMulticaster = new ConcurrentEventMulticaster(); + private ApplicationEventMulticaster createEventMulticaster(Set> listeners) { + SimpleApplicationEventMulticaster eventMulticaster = new SimpleApplicationEventMulticaster(); for (ApplicationListener listener : listeners) { if (ClassUtils.isAssignableValue(ConfigLoadedEventListener.class, listener)) { eventMulticaster.addApplicationListener(listener); diff --git a/starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/event/ConcurrentEventMulticaster.java b/starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/event/ConcurrentEventMulticaster.java deleted file mode 100644 index e4c6cd3e03b91fd9c5a4cdec411c39d3a4e3cf35..0000000000000000000000000000000000000000 --- a/starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/event/ConcurrentEventMulticaster.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.schbrain.framework.autoconfigure.apollo.event; - -import cn.hutool.core.thread.GlobalThreadPool; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.AbstractApplicationEventMulticaster; -import org.springframework.context.event.SimpleApplicationEventMulticaster; -import org.springframework.core.ResolvableType; -import org.springframework.scheduling.support.TaskUtils; - -import java.util.Collection; -import java.util.concurrent.Executor; - -/** - * expose {@link AbstractApplicationEventMulticaster#getApplicationListeners(ApplicationEvent, ResolvableType)} - * - * @author liaozan - * @since 2023-05-06 - */ -public class ConcurrentEventMulticaster extends SimpleApplicationEventMulticaster { - - public ConcurrentEventMulticaster() { - this(GlobalThreadPool.getExecutor()); - } - - public ConcurrentEventMulticaster(Executor executor) { - setTaskExecutor(executor); - setErrorHandler(TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER); - } - - @Override - public Collection> getApplicationListeners() { - return super.getApplicationListeners(); - } - -} \ No newline at end of file