T getStatus(Registration registration) {
- return target.getStatus(registration);
- }
-}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/discovery/registry/RegistryInterceptor.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/discovery/registry/RegistryInterceptor.java
deleted file mode 100644
index 0c9ef170..00000000
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/discovery/registry/RegistryInterceptor.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making Polaris available.
- *
- * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
- *
- * Licensed under the BSD 3-Clause License (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://opensource.org/licenses/BSD-3-Clause
- *
- * Unless required by applicable law or agreed to in writing, software distributed
- * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-
-package cn.polarismesh.agent.plugin.spring.cloud.discovery.registry;
-
-
-import java.util.Collections;
-
-import cn.polarismesh.agent.core.common.utils.ReflectionUtils;
-import cn.polarismesh.agent.plugin.spring.cloud.discovery.DiscoveryUtils;
-import cn.polarismesh.agent.plugin.spring.cloud.common.Holder;
-import cn.polarismesh.agent.plugin.spring.cloud.interceptor.BaseInterceptor;
-import com.tencent.cloud.common.util.ApplicationContextAwareUtils;
-import com.tencent.cloud.polaris.registry.PolarisRegistration;
-import com.tencent.cloud.polaris.registry.PolarisServiceRegistry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext;
-import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
-import org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration;
-import org.springframework.cloud.client.serviceregistry.Registration;
-import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
-
-/**
- * hack {@link AbstractAutoServiceRegistration#start()}
- *
- * Polaris Ribbon Server 实现类
- */
-public class RegistryInterceptor extends BaseInterceptor {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RegistryInterceptor.class);
-
- @Override
- public void onBefore(Object target, Object[] args) {
- if (!Holder.isAllowDiscovery()) {
- return;
- }
-
- LOGGER.debug("[PolarisAgent] replace ServiceRegistry to ProxyServiceRegistry, target : {}", target);
- ServiceRegistry registry;
- LosslessProxyServiceRegistry losslessProxyServiceRegistry;
-
- String clsName = target.getClass().getCanonicalName();
-
- if (clsName.contains("org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration")) {
- registry = (ServiceRegistry) ReflectionUtils.getObjectByFieldName(target, "serviceRegistry");
- losslessProxyServiceRegistry = new LosslessProxyServiceRegistry(new ProxyServiceRegistry(registry));
- ReflectionUtils.setValueByFieldName(target, "serviceRegistry", losslessProxyServiceRegistry);
- }
- else {
- registry = (ServiceRegistry) ReflectionUtils.getSuperObjectByFieldName(target, "serviceRegistry");
- losslessProxyServiceRegistry = new LosslessProxyServiceRegistry(new ProxyServiceRegistry(registry));
- ReflectionUtils.setSuperValueByFieldName(target, "serviceRegistry", losslessProxyServiceRegistry);
- }
- LOGGER.debug("[PolarisAgent] finished replace ServiceRegistry to ProxyServiceRegistry");
- }
-
- public static class ProxyServiceRegistry implements ServiceRegistry {
-
- private final ServiceRegistry target;
-
- private final PolarisServiceRegistry polarisRegistry;
-
- public ProxyServiceRegistry(ServiceRegistry target) {
- this.target = target;
- this.polarisRegistry = new PolarisServiceRegistry(Holder.getDiscoveryProperties(), Holder.getContextManager(),
- DiscoveryUtils.buildDiscoveryHandler(), Holder.getStaticMetadataManager(), Holder.getPolarisStatProperties());
- }
-
- private PolarisRegistration buildPolarisRegistration() {
- return new PolarisRegistration(
- Holder.getDiscoveryProperties(),
- Holder.getPolarisContextProperties(),
- Holder.getConsulContextProperties(),
- Holder.getContextManager().getSDKContext(),
- Holder.getStaticMetadataManager(),
- Holder.getNacosContextProperties(),
- getBeanIfExist(ServletWebServerApplicationContext.class),
- getBeanIfExist(ReactiveWebServerApplicationContext.class),
- Collections.emptyList()
- );
- }
-
- @Override
- public void register(Registration registration) {
- LOGGER.info("[PolarisAgent] begin do register to polaris action.");
- Holder.getPolarisContextProperties().setLocalPort(registration.getPort());
- PolarisRegistration polarisRegistration = buildPolarisRegistration();
- polarisRegistry.register(polarisRegistration);
- }
-
- @Override
- public void deregister(Registration registration) {
- LOGGER.info("[PolarisAgent] begin de deregister from polaris action.");
- Holder.getPolarisContextProperties().setLocalPort(registration.getPort());
- PolarisRegistration polarisRegistration = buildPolarisRegistration();
- polarisRegistry.deregister(polarisRegistration);
- }
-
- @Override
- public void close() {
- target.close();
- polarisRegistry.close();
- }
-
- @Override
- public void setStatus(Registration registration, String status) {
- PolarisRegistration polarisRegistration = buildPolarisRegistration();
- polarisRegistry.setStatus(polarisRegistration, status);
- }
-
- @Override
- public T getStatus(Registration registration) {
- PolarisRegistration polarisRegistration = buildPolarisRegistration();
- return (T) polarisRegistry.getStatus(polarisRegistration);
- }
-
- private T getBeanIfExist(Class cls) {
- try {
- return ApplicationContextAwareUtils.getApplicationContext().getBean(cls);
- }
- catch (Exception e) {
- LOGGER.error(e.getMessage());
- return null;
- }
- }
-
- }
-}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ApplicationContextAwareInterceptor.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ApplicationContextAwareInterceptor.java
index 6a3b5c92..bfcc6aee 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ApplicationContextAwareInterceptor.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ApplicationContextAwareInterceptor.java
@@ -20,9 +20,12 @@
import java.util.Arrays;
import java.util.List;
+import cn.polarismesh.agent.core.common.logger.CommonLogger;
+import cn.polarismesh.agent.core.common.logger.StdoutCommonLoggerFactory;
import cn.polarismesh.agent.plugin.spring.cloud.common.Holder;
import cn.polarismesh.agent.plugin.spring.cloud.config.ConfigHandler;
import cn.polarismesh.agent.plugin.spring.cloud.context.BaseBeanHandler;
+import cn.polarismesh.agent.plugin.spring.cloud.discovery.DiscoveryHandler;
import cn.polarismesh.agent.plugin.spring.cloud.metadata.MetadataHandler;
import cn.polarismesh.agent.plugin.spring.cloud.router.RouterHandler;
import cn.polarismesh.agent.plugin.spring.cloud.rpc.RpcEnhancementHandler;
@@ -37,9 +40,17 @@
public class ApplicationContextAwareInterceptor extends BaseInterceptor {
+ private static final CommonLogger logger = StdoutCommonLoggerFactory.INSTANCE
+ .getLogger(ApplicationContextAwareInterceptor.class.getCanonicalName());
+
@Override
public void onAfter(Object target, Object[] args, Object result, Throwable throwable) {
ConfigurableApplicationContext context = (ConfigurableApplicationContext) args[0];
+ String enable = context.getEnvironment().getProperty("spring.cloud.polaris.enabled");
+ if (null != enable && !Boolean.parseBoolean(enable)) {
+ logger.warn("polaris is disabled, no polaris inject actions will be taken");
+ return;
+ }
ApplicationContextAwareUtils utils = new ApplicationContextAwareUtils();
// MetadataContext 需要读取到 agent 配置的内容
@@ -59,7 +70,7 @@ public void onAfter(Object target, Object[] args, Object result, Throwable throw
private List buildAwares() {
return Arrays.asList(
new BaseBeanHandler(),
- new ConfigHandler(),
+ new DiscoveryHandler(),
new RpcEnhancementHandler(),
new MetadataHandler(),
new RouterHandler()
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/BlockingLoadBalancerClientInterceptor.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/BlockingLoadBalancerClientInterceptor.java
deleted file mode 100644
index f889039d..00000000
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/BlockingLoadBalancerClientInterceptor.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package cn.polarismesh.agent.plugin.spring.cloud.interceptor;
-
-import cn.polarismesh.agent.plugin.spring.cloud.interceptor.BaseInterceptor;
-import com.tencent.cloud.common.metadata.MetadataContextHolder;
-
-import org.springframework.cloud.client.ServiceInstance;
-
-/**
- * @author liaochuntao
- */
-public class BlockingLoadBalancerClientInterceptor extends BaseInterceptor {
-
- @Override
- public void onBefore(Object target, Object[] args) {
- Object server = args[0];
- if (server instanceof ServiceInstance) {
- ServiceInstance instance = (ServiceInstance) server;
- MetadataContextHolder.get().setLoadbalancer("host", instance.getHost());
- MetadataContextHolder.get().setLoadbalancer("port", String.valueOf(instance.getPort()));
- }
- }
-
-}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/DisableSpringCloudAlibabaInterceptor.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationInjectInterceptor.java
similarity index 71%
rename from polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/DisableSpringCloudAlibabaInterceptor.java
rename to polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationInjectInterceptor.java
index ddebb38e..0d614de6 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/DisableSpringCloudAlibabaInterceptor.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationInjectInterceptor.java
@@ -17,6 +17,10 @@
package cn.polarismesh.agent.plugin.spring.cloud.interceptor;
+import cn.polarismesh.agent.plugin.spring.cloud.common.Holder;
+import com.tencent.cloud.polaris.config.adapter.PolarisConfigFileLocator;
+import com.tencent.polaris.configuration.api.core.ConfigFileService;
+import com.tencent.polaris.configuration.factory.ConfigFileServiceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
@@ -34,9 +38,9 @@
*
* @author liaochuntao
*/
-public class DisableSpringCloudAlibabaInterceptor extends BaseInterceptor {
+public class ConfigurationInjectInterceptor extends BaseInterceptor {
- private static final Logger LOGGER = LoggerFactory.getLogger(DisableSpringCloudAlibabaInterceptor.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationInjectInterceptor.class);
@Override
public void onBefore(Object target, Object[] args) {
@@ -59,17 +63,19 @@ public void postProcessEnvironment(ConfigurableEnvironment environment, SpringAp
}
private void disableSpringCloudAlibabaAbility(ConfigurableEnvironment environment) {
-
- String disableSCA = "__disable__sca__";
-
+// String disableSCA = "__disable__sca__";
+//
+// Properties properties = new Properties();
+// properties.setProperty("spring.cloud.sentinel.enabled", "false");
+// properties.setProperty("spring.cloud.nacos.discovery.watch.enabled", "false");
+// properties.setProperty("spring.cloud.loadbalancer.cache.enabled", "false");
+// properties.setProperty("spring.cloud.nacos.config.enabled", "false");
+
+ String disableCheck = "__disable__check__";
Properties properties = new Properties();
- properties.setProperty("spring.cloud.sentinel.enabled", "false");
- properties.setProperty("spring.cloud.nacos.discovery.watch.enabled", "false");
- properties.setProperty("spring.cloud.loadbalancer.cache.enabled", "false");
- properties.setProperty("spring.cloud.nacos.config.enabled", "false");
-
+ properties.setProperty("spring.cloud.polaris.config.import-check.enabled", "false");
// 设置 spring.cloud.sentinel.enabled 为 false
- environment.getPropertySources().addFirst(new PropertiesPropertySource(disableSCA, properties));
+ environment.getPropertySources().addFirst(new PropertiesPropertySource(disableCheck, properties));
LOGGER.info("[PolarisAgent] disable spring cloud alibaba all ability");
}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/EnvironmentChangeEventListener.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/EnvironmentChangeEventListener.java
new file mode 100644
index 00000000..e6000579
--- /dev/null
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/EnvironmentChangeEventListener.java
@@ -0,0 +1,48 @@
+package cn.polarismesh.agent.plugin.spring.cloud.interceptor;
+
+import cn.polarismesh.agent.plugin.spring.cloud.config.ConfigHandler;
+import cn.polarismesh.agent.plugin.spring.cloud.metadata.MetadataHandler;
+import cn.polarismesh.agent.plugin.spring.cloud.router.RouterHandler;
+import cn.polarismesh.agent.plugin.spring.cloud.rpc.RpcEnhancementHandler;
+
+import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.context.event.SmartApplicationListener;
+
+public class EnvironmentChangeEventListener implements SmartApplicationListener {
+
+ private final RouterHandler routerHandler = new RouterHandler();
+
+ private final MetadataHandler metadataHandler = new MetadataHandler();
+
+ private final RpcEnhancementHandler rpcEnhancementHandler = new RpcEnhancementHandler();
+
+ private final ConfigHandler configHandler = new ConfigHandler();
+
+ @Override
+ public boolean supportsEventType(Class extends ApplicationEvent> eventType) {
+ return eventType == EnvironmentChangeEvent.class || eventType == ContextRefreshedEvent.class;
+ }
+
+ @Override
+ public void onApplicationEvent(ApplicationEvent event) {
+ Object source = event.getSource();
+ if (!(source instanceof ApplicationContext)) {
+ return;
+ }
+ ApplicationContext applicationContext = (ApplicationContext) source;
+ ConfigurableApplicationContext cfgCtx1 = (ConfigurableApplicationContext) applicationContext;
+ String enable = cfgCtx1.getEnvironment().getProperty("spring.cloud.polaris.enabled");
+ System.out.println("enable is " + enable);
+ if (null == enable || Boolean.parseBoolean(enable)) {
+ configHandler.setApplicationContext(applicationContext);
+ routerHandler.setApplicationContext(applicationContext);
+ metadataHandler.setApplicationContext(applicationContext);
+ rpcEnhancementHandler.setApplicationContext(applicationContext);
+ }
+ }
+
+}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/router/RouterHandler.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/router/RouterHandler.java
index 8203b7d1..a9c53a65 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/router/RouterHandler.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/router/RouterHandler.java
@@ -17,21 +17,29 @@
package cn.polarismesh.agent.plugin.spring.cloud.router;
+import java.util.ArrayList;
+import java.util.Map;
import java.util.function.Supplier;
import cn.polarismesh.agent.core.common.utils.ClassUtils;
import cn.polarismesh.agent.plugin.spring.cloud.common.Holder;
import cn.polarismesh.agent.plugin.spring.cloud.context.AbstractContextHandler;
+import com.tencent.cloud.polaris.context.PolarisSDKContextManager;
+import com.tencent.cloud.polaris.router.PolarisRouterServiceInstanceListSupplier;
import com.tencent.cloud.polaris.router.config.FeignAutoConfiguration;
import com.tencent.cloud.polaris.router.config.LoadBalancerConfiguration;
import com.tencent.cloud.polaris.router.config.RouterAutoConfiguration;
import com.tencent.cloud.polaris.router.config.properties.PolarisMetadataRouterProperties;
import com.tencent.cloud.polaris.router.config.properties.PolarisNearByRouterProperties;
import com.tencent.cloud.polaris.router.config.properties.PolarisRuleBasedRouterProperties;
+import com.tencent.cloud.polaris.router.spi.RouterRequestInterceptor;
+import com.tencent.cloud.polaris.router.spi.RouterResponseInterceptor;
+import com.tencent.cloud.rpc.enhancement.transformer.InstanceTransformer;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
@@ -89,13 +97,63 @@ public PolarisRuleBasedRouterProperties get() {
}
if (null != ClassUtils.getClazz("org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier",
Thread.currentThread().getContextClassLoader())) {
- registerBean(applicationContext, "loadBalancerConfiguration", (ctx, name) -> {
- ConfigurableApplicationContext cfgCtx = (ConfigurableApplicationContext) ctx;
- DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) cfgCtx.getBeanFactory();
- beanFactory.registerBeanDefinition(name,
- BeanDefinitionBuilder.genericBeanDefinition(LoadBalancerConfiguration.class)
- .getBeanDefinition());
+ if (null != ClassUtils.getClazz("org.springframework.web.reactive.function.client.WebClient", Thread.currentThread()
+ .getContextClassLoader())) {
+ String reactiveEnableStr = applicationContext.getEnvironment()
+ .getProperty("spring.cloud.discovery.reactive.enabled");
+ if (null == reactiveEnableStr || Boolean.parseBoolean(reactiveEnableStr)) {
+ registerBean(applicationContext, "polarisRouterDiscoveryClientServiceInstanceListSupplier", (ctx, name) -> {
+ ConfigurableApplicationContext cfgCtx = (ConfigurableApplicationContext) ctx;
+ DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) cfgCtx.getBeanFactory();
+ beanFactory.registerBeanDefinition(name, BeanDefinitionBuilder.genericBeanDefinition(ServiceInstanceListSupplier.class, new Supplier() {
+ @Override
+ public ServiceInstanceListSupplier get() {
+ PolarisSDKContextManager polarisSDKContextManager = (PolarisSDKContextManager) applicationContext.getBean("polarisSDKContextManager");
+ Map requestInterceptors = applicationContext.getBeansOfType(RouterRequestInterceptor.class);
+ Map responseInterceptors = applicationContext.getBeansOfType(RouterResponseInterceptor.class);
+ InstanceTransformer instanceTransformer = applicationContext.getBean("instanceTransformer", InstanceTransformer.class);
+ return new PolarisRouterServiceInstanceListSupplier(
+ ServiceInstanceListSupplier.builder().withDiscoveryClient()
+ .build((ConfigurableApplicationContext) applicationContext),
+ polarisSDKContextManager.getRouterAPI(),
+ new ArrayList<>(requestInterceptors.values()),
+ new ArrayList<>(responseInterceptors.values()),
+ instanceTransformer);
+ }
+ }).getBeanDefinition());
+ });
+ }
+ }
+ String blockingEnable = applicationContext.getEnvironment().getProperty("spring.cloud.discovery.blocking.enabled");
+ if (null == blockingEnable || Boolean.parseBoolean(blockingEnable)) {
+ registerBean(applicationContext, "polarisRouterDiscoveryClientServiceInstanceListSupplier", (ctx, name) -> {
+ ConfigurableApplicationContext cfgCtx = (ConfigurableApplicationContext) ctx;
+ DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) cfgCtx.getBeanFactory();
+ beanFactory.registerBeanDefinition(name, BeanDefinitionBuilder.genericBeanDefinition(ServiceInstanceListSupplier.class, new Supplier() {
+ @Override
+ public ServiceInstanceListSupplier get() {
+ PolarisSDKContextManager polarisSDKContextManager = (PolarisSDKContextManager) applicationContext.getBean("polarisSDKContextManager");
+ Map requestInterceptors = applicationContext.getBeansOfType(RouterRequestInterceptor.class);
+ Map responseInterceptors = applicationContext.getBeansOfType(RouterResponseInterceptor.class);
+ InstanceTransformer instanceTransformer = applicationContext.getBean("instanceTransformer", InstanceTransformer.class);
+ return new PolarisRouterServiceInstanceListSupplier(
+ ServiceInstanceListSupplier.builder().withBlockingDiscoveryClient().build((ConfigurableApplicationContext) applicationContext),
+ polarisSDKContextManager.getRouterAPI(),
+ new ArrayList<>(requestInterceptors.values()),
+ new ArrayList<>(responseInterceptors.values()),
+ instanceTransformer);
+ }
+ }).getBeanDefinition());
});
+
+ }
+// registerBean(applicationContext, "loadBalancerConfiguration", (ctx, name) -> {
+// ConfigurableApplicationContext cfgCtx = (ConfigurableApplicationContext) ctx;
+// DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) cfgCtx.getBeanFactory();
+// beanFactory.registerBeanDefinition(name,
+// BeanDefinitionBuilder.genericBeanDefinition(LoadBalancerConfiguration.class)
+// .getBeanDefinition());
+// });
}
}
diff --git a/pom.xml b/pom.xml
index 9718d95f..0a5565ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
1.7.0-RC.0
- 1.15.3
+ 1.15.4-SNAPSHOT
UTF-8
false
UTF-8
From 761549a16ccee92ffd28e0d67cc7a3a942c9199f Mon Sep 17 00:00:00 2001
From: andrew shan <45474304+andrewshan@users.noreply.github.com>
Date: Mon, 15 Apr 2024 11:13:41 +0800
Subject: [PATCH 02/24] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=E6=97=A0?=
=?UTF-8?q?=E7=94=A8=E7=9A=84=E5=AF=BC=E5=85=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../agent/plugin/spring/cloud/MainPlugin.java | 2 +-
.../AbstractContextHandler.java | 2 +-
.../{context => base}/BaseBeanHandler.java | 14 +-----
.../spring/cloud/config/ConfigHandler.java | 2 +-
.../cloud/discovery/DiscoveryHandler.java | 2 +-
.../ApplicationContextAwareInterceptor.java | 3 +-
.../ConfigurationInjectInterceptor.java | 1 -
.../EnvironmentChangeEventListener.java | 48 -------------------
.../cloud/metadata/MetadataHandler.java | 2 +-
.../spring/cloud/router/RouterHandler.java | 17 +++----
.../cloud/rpc/RpcEnhancementHandler.java | 2 +-
11 files changed, 17 insertions(+), 78 deletions(-)
rename polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/{context => base}/AbstractContextHandler.java (96%)
rename polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/{context => base}/BaseBeanHandler.java (84%)
delete mode 100644 polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/EnvironmentChangeEventListener.java
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/MainPlugin.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/MainPlugin.java
index b8a08dbe..bc86a5bd 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/MainPlugin.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/MainPlugin.java
@@ -56,7 +56,7 @@ private void addPolarisTransformers(TransformOperations operations) {
operations.transform(ClassNames.APPLICATION_CONTEXT_AWARE, ApplicationContextAwareTransform.class);
// EnvironmentPostProcessor 处理
- operations.transform(ClassNames.ENVIRONMENT_POST_PROCESSOR, ConfigurationInjectTransform.class);
+ // operations.transform(ClassNames.ENVIRONMENT_POST_PROCESSOR, ConfigurationInjectTransform.class);
}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/context/AbstractContextHandler.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/base/AbstractContextHandler.java
similarity index 96%
rename from polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/context/AbstractContextHandler.java
rename to polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/base/AbstractContextHandler.java
index 73215c91..400790d6 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/context/AbstractContextHandler.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/base/AbstractContextHandler.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations under the License.
*/
-package cn.polarismesh.agent.plugin.spring.cloud.context;
+package cn.polarismesh.agent.plugin.spring.cloud.base;
import java.util.function.BiConsumer;
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/context/BaseBeanHandler.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/base/BaseBeanHandler.java
similarity index 84%
rename from polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/context/BaseBeanHandler.java
rename to polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/base/BaseBeanHandler.java
index 13e4adcd..38974ef9 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/context/BaseBeanHandler.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/base/BaseBeanHandler.java
@@ -15,29 +15,17 @@
* specific language governing permissions and limitations under the License.
*/
-package cn.polarismesh.agent.plugin.spring.cloud.context;
+package cn.polarismesh.agent.plugin.spring.cloud.base;
import java.util.function.Supplier;
import cn.polarismesh.agent.plugin.spring.cloud.common.Holder;
-import cn.polarismesh.agent.plugin.spring.cloud.interceptor.EnvironmentChangeEventListener;
import com.tencent.cloud.common.metadata.StaticMetadataManager;
-import com.tencent.cloud.plugin.lossless.config.LosslessAutoConfiguration;
-import com.tencent.cloud.polaris.PolarisDiscoveryProperties;
import com.tencent.cloud.polaris.context.PolarisSDKContextManager;
import com.tencent.cloud.polaris.context.ServiceRuleManager;
import com.tencent.cloud.polaris.context.config.PolarisContextPostConfiguration;
import com.tencent.cloud.polaris.context.config.PolarisContextProperties;
-import com.tencent.cloud.polaris.discovery.PolarisDiscoveryAutoConfiguration;
-import com.tencent.cloud.polaris.discovery.PolarisDiscoveryHandler;
import com.tencent.cloud.polaris.loadbalancer.PolarisLoadBalancerAutoConfiguration;
-import com.tencent.cloud.polaris.registry.PolarisAutoServiceRegistration;
-import com.tencent.cloud.polaris.registry.PolarisRegistration;
-import com.tencent.cloud.polaris.registry.PolarisServiceRegistry;
-import com.tencent.cloud.polaris.registry.PolarisServiceRegistryAutoConfiguration;
-import com.tencent.cloud.rpc.enhancement.stat.config.PolarisStatProperties;
-import com.tencent.polaris.assembly.api.AssemblyAPI;
-import com.tencent.polaris.client.api.SDKContext;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/config/ConfigHandler.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/config/ConfigHandler.java
index 68c5e904..9f5a7212 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/config/ConfigHandler.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/config/ConfigHandler.java
@@ -20,7 +20,7 @@
import java.util.function.Supplier;
import cn.polarismesh.agent.plugin.spring.cloud.common.Holder;
-import cn.polarismesh.agent.plugin.spring.cloud.context.AbstractContextHandler;
+import cn.polarismesh.agent.plugin.spring.cloud.base.AbstractContextHandler;
import com.tencent.cloud.polaris.config.PolarisConfigAutoConfiguration;
import com.tencent.cloud.polaris.config.adapter.PolarisConfigFileLocator;
import com.tencent.cloud.polaris.config.adapter.PolarisPropertySourceManager;
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/discovery/DiscoveryHandler.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/discovery/DiscoveryHandler.java
index 4f4e30e0..d949f594 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/discovery/DiscoveryHandler.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/discovery/DiscoveryHandler.java
@@ -3,7 +3,7 @@
import java.util.function.Supplier;
import cn.polarismesh.agent.plugin.spring.cloud.common.Holder;
-import cn.polarismesh.agent.plugin.spring.cloud.context.AbstractContextHandler;
+import cn.polarismesh.agent.plugin.spring.cloud.base.AbstractContextHandler;
import com.tencent.cloud.plugin.lossless.config.LosslessAutoConfiguration;
import com.tencent.cloud.polaris.PolarisDiscoveryProperties;
import com.tencent.cloud.polaris.context.PolarisSDKContextManager;
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ApplicationContextAwareInterceptor.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ApplicationContextAwareInterceptor.java
index bfcc6aee..2b0e79d4 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ApplicationContextAwareInterceptor.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ApplicationContextAwareInterceptor.java
@@ -23,8 +23,7 @@
import cn.polarismesh.agent.core.common.logger.CommonLogger;
import cn.polarismesh.agent.core.common.logger.StdoutCommonLoggerFactory;
import cn.polarismesh.agent.plugin.spring.cloud.common.Holder;
-import cn.polarismesh.agent.plugin.spring.cloud.config.ConfigHandler;
-import cn.polarismesh.agent.plugin.spring.cloud.context.BaseBeanHandler;
+import cn.polarismesh.agent.plugin.spring.cloud.base.BaseBeanHandler;
import cn.polarismesh.agent.plugin.spring.cloud.discovery.DiscoveryHandler;
import cn.polarismesh.agent.plugin.spring.cloud.metadata.MetadataHandler;
import cn.polarismesh.agent.plugin.spring.cloud.router.RouterHandler;
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationInjectInterceptor.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationInjectInterceptor.java
index 0d614de6..526f75e8 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationInjectInterceptor.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationInjectInterceptor.java
@@ -74,7 +74,6 @@ private void disableSpringCloudAlibabaAbility(ConfigurableEnvironment environmen
String disableCheck = "__disable__check__";
Properties properties = new Properties();
properties.setProperty("spring.cloud.polaris.config.import-check.enabled", "false");
- // 设置 spring.cloud.sentinel.enabled 为 false
environment.getPropertySources().addFirst(new PropertiesPropertySource(disableCheck, properties));
LOGGER.info("[PolarisAgent] disable spring cloud alibaba all ability");
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/EnvironmentChangeEventListener.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/EnvironmentChangeEventListener.java
deleted file mode 100644
index e6000579..00000000
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/EnvironmentChangeEventListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package cn.polarismesh.agent.plugin.spring.cloud.interceptor;
-
-import cn.polarismesh.agent.plugin.spring.cloud.config.ConfigHandler;
-import cn.polarismesh.agent.plugin.spring.cloud.metadata.MetadataHandler;
-import cn.polarismesh.agent.plugin.spring.cloud.router.RouterHandler;
-import cn.polarismesh.agent.plugin.spring.cloud.rpc.RpcEnhancementHandler;
-
-import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.event.ContextRefreshedEvent;
-import org.springframework.context.event.SmartApplicationListener;
-
-public class EnvironmentChangeEventListener implements SmartApplicationListener {
-
- private final RouterHandler routerHandler = new RouterHandler();
-
- private final MetadataHandler metadataHandler = new MetadataHandler();
-
- private final RpcEnhancementHandler rpcEnhancementHandler = new RpcEnhancementHandler();
-
- private final ConfigHandler configHandler = new ConfigHandler();
-
- @Override
- public boolean supportsEventType(Class extends ApplicationEvent> eventType) {
- return eventType == EnvironmentChangeEvent.class || eventType == ContextRefreshedEvent.class;
- }
-
- @Override
- public void onApplicationEvent(ApplicationEvent event) {
- Object source = event.getSource();
- if (!(source instanceof ApplicationContext)) {
- return;
- }
- ApplicationContext applicationContext = (ApplicationContext) source;
- ConfigurableApplicationContext cfgCtx1 = (ConfigurableApplicationContext) applicationContext;
- String enable = cfgCtx1.getEnvironment().getProperty("spring.cloud.polaris.enabled");
- System.out.println("enable is " + enable);
- if (null == enable || Boolean.parseBoolean(enable)) {
- configHandler.setApplicationContext(applicationContext);
- routerHandler.setApplicationContext(applicationContext);
- metadataHandler.setApplicationContext(applicationContext);
- rpcEnhancementHandler.setApplicationContext(applicationContext);
- }
- }
-
-}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/metadata/MetadataHandler.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/metadata/MetadataHandler.java
index 1212f44d..b248ec4b 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/metadata/MetadataHandler.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/metadata/MetadataHandler.java
@@ -17,7 +17,7 @@
package cn.polarismesh.agent.plugin.spring.cloud.metadata;
-import cn.polarismesh.agent.plugin.spring.cloud.context.AbstractContextHandler;
+import cn.polarismesh.agent.plugin.spring.cloud.base.AbstractContextHandler;
import com.tencent.cloud.metadata.config.MetadataTransferAutoConfiguration;
import org.springframework.beans.BeansException;
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/router/RouterHandler.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/router/RouterHandler.java
index a9c53a65..bebe86c5 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/router/RouterHandler.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/router/RouterHandler.java
@@ -23,11 +23,10 @@
import cn.polarismesh.agent.core.common.utils.ClassUtils;
import cn.polarismesh.agent.plugin.spring.cloud.common.Holder;
-import cn.polarismesh.agent.plugin.spring.cloud.context.AbstractContextHandler;
+import cn.polarismesh.agent.plugin.spring.cloud.base.AbstractContextHandler;
import com.tencent.cloud.polaris.context.PolarisSDKContextManager;
import com.tencent.cloud.polaris.router.PolarisRouterServiceInstanceListSupplier;
import com.tencent.cloud.polaris.router.config.FeignAutoConfiguration;
-import com.tencent.cloud.polaris.router.config.LoadBalancerConfiguration;
import com.tencent.cloud.polaris.router.config.RouterAutoConfiguration;
import com.tencent.cloud.polaris.router.config.properties.PolarisMetadataRouterProperties;
import com.tencent.cloud.polaris.router.config.properties.PolarisNearByRouterProperties;
@@ -80,7 +79,7 @@ public PolarisRuleBasedRouterProperties get() {
}
}).getBeanDefinition());
});
- registerBean(applicationContext, "routerAutoConfiguration", (ctx, name) -> {
+ registerBean(applicationContext, "routerAutoConfiguration", (ctx, name) -> {
ConfigurableApplicationContext cfgCtx = (ConfigurableApplicationContext) ctx;
DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) cfgCtx.getBeanFactory();
beanFactory.registerBeanDefinition(name,
@@ -88,7 +87,7 @@ public PolarisRuleBasedRouterProperties get() {
});
if (null != ClassUtils.getClazz("feign.RequestInterceptor",
Thread.currentThread().getContextClassLoader())) {
- registerBean(applicationContext, "feignAutoConfiguration", (ctx, name) -> {
+ registerBean(applicationContext, "feignAutoConfiguration", (ctx, name) -> {
ConfigurableApplicationContext cfgCtx = (ConfigurableApplicationContext) ctx;
DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) cfgCtx.getBeanFactory();
beanFactory.registerBeanDefinition(name,
@@ -124,9 +123,10 @@ public ServiceInstanceListSupplier get() {
});
}
}
- String blockingEnable = applicationContext.getEnvironment().getProperty("spring.cloud.discovery.blocking.enabled");
+ String blockingEnable = applicationContext.getEnvironment()
+ .getProperty("spring.cloud.discovery.blocking.enabled");
if (null == blockingEnable || Boolean.parseBoolean(blockingEnable)) {
- registerBean(applicationContext, "polarisRouterDiscoveryClientServiceInstanceListSupplier", (ctx, name) -> {
+ registerBean(applicationContext, "polarisRouterDiscoveryClientServiceInstanceListSupplier", (ctx, name) -> {
ConfigurableApplicationContext cfgCtx = (ConfigurableApplicationContext) ctx;
DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) cfgCtx.getBeanFactory();
beanFactory.registerBeanDefinition(name, BeanDefinitionBuilder.genericBeanDefinition(ServiceInstanceListSupplier.class, new Supplier() {
@@ -137,14 +137,15 @@ public ServiceInstanceListSupplier get() {
Map responseInterceptors = applicationContext.getBeansOfType(RouterResponseInterceptor.class);
InstanceTransformer instanceTransformer = applicationContext.getBean("instanceTransformer", InstanceTransformer.class);
return new PolarisRouterServiceInstanceListSupplier(
- ServiceInstanceListSupplier.builder().withBlockingDiscoveryClient().build((ConfigurableApplicationContext) applicationContext),
+ ServiceInstanceListSupplier.builder().withBlockingDiscoveryClient()
+ .build((ConfigurableApplicationContext) applicationContext),
polarisSDKContextManager.getRouterAPI(),
new ArrayList<>(requestInterceptors.values()),
new ArrayList<>(responseInterceptors.values()),
instanceTransformer);
}
}).getBeanDefinition());
- });
+ });
}
// registerBean(applicationContext, "loadBalancerConfiguration", (ctx, name) -> {
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/rpc/RpcEnhancementHandler.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/rpc/RpcEnhancementHandler.java
index 8039d5c5..da1c979e 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/rpc/RpcEnhancementHandler.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/rpc/RpcEnhancementHandler.java
@@ -17,7 +17,7 @@
package cn.polarismesh.agent.plugin.spring.cloud.rpc;
-import cn.polarismesh.agent.plugin.spring.cloud.context.AbstractContextHandler;
+import cn.polarismesh.agent.plugin.spring.cloud.base.AbstractContextHandler;
import com.tencent.cloud.plugin.discovery.adapter.config.NacosDiscoveryAdapterAutoConfiguration;
import com.tencent.cloud.rpc.enhancement.config.RpcEnhancementAutoConfiguration;
import org.slf4j.Logger;
From 8e5277b4d2d7a31e59ca22cf87a8ad4f491792ed Mon Sep 17 00:00:00 2001
From: andrew shan <45474304+andrewshan@users.noreply.github.com>
Date: Mon, 15 Apr 2024 12:17:06 +0800
Subject: [PATCH 03/24] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0actuator?=
=?UTF-8?q?=E5=88=B0demo=E4=B8=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
polaris-agent-build/conf/polaris-agent.config | 2 +-
.../quickstart-examples/consumer/pom.xml | 5 ++
.../quickstart-examples/provider/pom.xml | 5 ++
.../spring-cloud-2023/application.properties | 47 +++----------------
4 files changed, 17 insertions(+), 42 deletions(-)
diff --git a/polaris-agent-build/conf/polaris-agent.config b/polaris-agent-build/conf/polaris-agent.config
index 0a206306..0e3aab95 100644
--- a/polaris-agent-build/conf/polaris-agent.config
+++ b/polaris-agent-build/conf/polaris-agent.config
@@ -1 +1 @@
-plugins.enable=spring-cloud-2021-plugin,spring-cloud-2020-plugin
\ No newline at end of file
+plugins.enable=spring-cloud-2023-plugin
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/pom.xml b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/pom.xml
index 08bb97ab..a508d3bb 100644
--- a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/pom.xml
+++ b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/pom.xml
@@ -56,6 +56,11 @@
org.springframework.cloud
spring-cloud-starter-loadbalancer