diff --git a/agent/hippo4j-agent-core/pom.xml b/agent/hippo4j-agent-core/pom.xml
index e020e562..97412d51 100644
--- a/agent/hippo4j-agent-core/pom.xml
+++ b/agent/hippo4j-agent-core/pom.xml
@@ -77,7 +77,11 @@
cn.hippo4j
hippo4j-threadpool-infra-common
${project.version}
- provided
+
+
+ cn.hippo4j
+ hippo4j-threadpool-dynamic-mode-config
+ ${project.version}
diff --git a/agent/hippo4j-agent-plugin/spring-plugins/pom.xml b/agent/hippo4j-agent-plugin/spring-plugins/pom.xml
index d6855dbe..42b725b5 100644
--- a/agent/hippo4j-agent-plugin/spring-plugins/pom.xml
+++ b/agent/hippo4j-agent-plugin/spring-plugins/pom.xml
@@ -22,14 +22,4 @@
UTF-8
/..
-
-
-
-
- cn.hippo4j
- hippo4j-agent-spring-plugin-common
- ${project.version}
-
-
-
\ No newline at end of file
diff --git a/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-1x-plugin/pom.xml b/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-1x-plugin/pom.xml
index 1605aaf0..ccec3c7b 100644
--- a/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-1x-plugin/pom.xml
+++ b/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-1x-plugin/pom.xml
@@ -33,6 +33,7 @@
cn.hippo4j
hippo4j-agent-spring-plugin-common
provided
+ ${project.version}
diff --git a/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-2x-plugin/pom.xml b/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-2x-plugin/pom.xml
index 5eb55742..dc3d87cf 100644
--- a/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-2x-plugin/pom.xml
+++ b/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-2x-plugin/pom.xml
@@ -21,6 +21,7 @@
cn.hippo4j
hippo4j-agent-spring-plugin-common
provided
+ ${project.version}
@@ -36,5 +37,11 @@
${project.version}
provided
+
+
+ com.ctrip.framework.apollo
+ apollo-client
+ provided
+
\ No newline at end of file
diff --git a/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-2x-plugin/src/main/java/cn/hippo4j/agent/plugin/spring/boot/v2/DynamicThreadPoolChangeHandlerSpring2x.java b/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-2x-plugin/src/main/java/cn/hippo4j/agent/plugin/spring/boot/v2/DynamicThreadPoolChangeHandlerSpring2x.java
index f490618c..bcda15e4 100644
--- a/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-2x-plugin/src/main/java/cn/hippo4j/agent/plugin/spring/boot/v2/DynamicThreadPoolChangeHandlerSpring2x.java
+++ b/agent/hippo4j-agent-plugin/spring-plugins/spring-boot-2x-plugin/src/main/java/cn/hippo4j/agent/plugin/spring/boot/v2/DynamicThreadPoolChangeHandlerSpring2x.java
@@ -17,20 +17,57 @@
package cn.hippo4j.agent.plugin.spring.boot.v2;
+import cn.hippo4j.agent.core.logging.api.ILog;
+import cn.hippo4j.agent.core.logging.api.LogManager;
+import cn.hippo4j.agent.plugin.spring.common.conf.SpringBootConfig;
import cn.hippo4j.threadpool.dynamic.mode.config.properties.BootstrapConfigProperties;
import cn.hippo4j.threadpool.dynamic.mode.config.refresher.AbstractConfigThreadPoolDynamicRefresh;
+import com.ctrip.framework.apollo.Config;
+import com.ctrip.framework.apollo.ConfigChangeListener;
+import com.ctrip.framework.apollo.ConfigFile;
+import com.ctrip.framework.apollo.ConfigService;
+import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
+import com.ctrip.framework.apollo.model.ConfigChange;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
import org.springframework.boot.context.properties.source.MapConfigurationPropertySource;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import static cn.hippo4j.agent.core.conf.Constants.SPRING_BOOT_CONFIG_PREFIX;
+
/**
* Dynamic thread pool change handler spring 2x
*/
public class DynamicThreadPoolChangeHandlerSpring2x extends AbstractConfigThreadPoolDynamicRefresh {
+ private static ILog LOGGER = LogManager.getLogger(DynamicThreadPoolChangeHandlerSpring2x.class);
+
+ @Override
+ public void registerListener() {
+ List apolloNamespaces = SpringBootConfig.Spring.Dynamic.Thread_Pool.Apollo.NAMESPACE;
+ String namespace = apolloNamespaces.get(0);
+ String configFileType = SpringBootConfig.Spring.Dynamic.Thread_Pool.CONFIG_FILE_TYPE;
+ Config config = ConfigService.getConfig(String.format("%s.%s", namespace, configFileType));
+ ConfigChangeListener configChangeListener = configChangeEvent -> {
+ String replacedNamespace = namespace.replaceAll("." + configFileType, "");
+ ConfigFileFormat configFileFormat = ConfigFileFormat.fromString(configFileType);
+ ConfigFile configFile = ConfigService.getConfigFile(replacedNamespace, configFileFormat);
+ Map newChangeValueMap = new HashMap<>();
+ configChangeEvent.changedKeys().stream().filter(each -> each.contains(SPRING_BOOT_CONFIG_PREFIX)).forEach(each -> {
+ ConfigChange change = configChangeEvent.getChange(each);
+ String newValue = change.getNewValue();
+ newChangeValueMap.put(each, newValue);
+ });
+ dynamicRefresh(configFileType, configFile.getContent(), newChangeValueMap);
+ };
+ config.addChangeListener(configChangeListener);
+ LOGGER.info("[Hippo4j-Agent] Dynamic thread pool refresher, add apollo listener success. namespace: {}", namespace);
+ }
+
@Override
public BootstrapConfigProperties buildBootstrapProperties(Map