diff --git a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java
index 9f0ed504..849701b2 100644
--- a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java
+++ b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java
@@ -20,6 +20,7 @@
import cn.polarismesh.agent.core.bootstrap.starter.BootStrapStarter;
import cn.polarismesh.agent.core.bootstrap.util.AgentDirUtils;
import cn.polarismesh.agent.core.common.utils.JarFileUtils;
+import cn.polarismesh.agent.core.bootstrap.PolarisInitProperties;
import java.lang.instrument.Instrumentation;
import java.util.List;
@@ -40,6 +41,9 @@ public static void premain(String agentArgs, Instrumentation instrumentation, St
return;
}
+ PolarisInitProperties polarisInitProperties = new PolarisInitProperties();
+ polarisInitProperties.initialize();
+
logger.info("[Bootstrap] polaris-agent agentArgs:" + agentArgs);
logger.info("[Bootstrap] polarisAgentBootStrap.ClassLoader:" + PolarisAgentBootStrap.class.getClassLoader());
logger.info("[Bootstrap] contextClassLoader:" + Thread.currentThread().getContextClassLoader());
diff --git a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisInitProperties.java b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisInitProperties.java
new file mode 100644
index 00000000..6c05c357
--- /dev/null
+++ b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisInitProperties.java
@@ -0,0 +1,12 @@
+package cn.polarismesh.agent.core.bootstrap;
+
+public class PolarisInitProperties {
+
+ public void initialize() {
+
+ // ban nacos as sct currently does not support double registration
+ System.setProperty("spring.cloud.nacos.config.enabled", "false");
+ System.setProperty("spring.cloud.nacos.discovery.enabled", "false");
+
+ }
+}
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2022-examples/quickstart-examples/consumer/src/main/resources/bootstrap.properties b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2022-examples/quickstart-examples/consumer/src/main/resources/bootstrap.properties
index 4019bf5f..29cc2dbe 100644
--- a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2022-examples/quickstart-examples/consumer/src/main/resources/bootstrap.properties
+++ b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2022-examples/quickstart-examples/consumer/src/main/resources/bootstrap.properties
@@ -1,7 +1,15 @@
server.port=65002
spring.application.name=service-consumer-2022
+management.endpoints.web.exposure.include=*
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
-spring.cloud.nacos.discovery.enabled=false
-spring.cloud.nacos.config.enabled=false
-spring.main.allow-bean-definition-overriding=true
+spring.cloud.nacos.config.server-addr=127.0.0.1:8848
+spring.cloud.nacos.discovery.enabled=true
+spring.cloud.nacos.config.enabled=true
+spring.cloud.nacos.username=nacos
+spring.cloud.nacos.password=nacos
+spring.cloud.nacos.discovery.fail-fast=true
+
+spring.cloud.loadbalancer.nacos.enabled=true
+# use feign client in GraalVM environment need to set below config
+spring.cloud.refresh.enabled=false
spring.main.allow-circular-references=true
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2022-examples/quickstart-examples/provider-a/src/main/resources/bootstrap.properties b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2022-examples/quickstart-examples/provider-a/src/main/resources/bootstrap.properties
index 029dbc97..29dbdc7b 100644
--- a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2022-examples/quickstart-examples/provider-a/src/main/resources/bootstrap.properties
+++ b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2022-examples/quickstart-examples/provider-a/src/main/resources/bootstrap.properties
@@ -1,10 +1,18 @@
server.port=65001
spring.application.name=service-provider-2022
+spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
-spring.cloud.nacos.config.enabled=false
-spring.cloud.nacos.discovery.enabled=false
+spring.cloud.nacos.config.enabled=true
+spring.cloud.nacos.discovery.enabled=true
+#spring.cloud.nacos.discovery.instance-enabled=true
+#only register IPv4 instance
+#spring.cloud.nacos.discovery.ip-type=IPv4
+#only register IPv6 instance
+#spring.cloud.nacos.discovery.ip-type=IPv6
+
spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos
+
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
-spring.main.allow-bean-definition-overriding=true
\ No newline at end of file
+spring.main.allow-circular-references=true
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/application.properties b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/application.properties
new file mode 100644
index 00000000..a73f1e31
--- /dev/null
+++ b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/application.properties
@@ -0,0 +1,27 @@
+#server.port=65002
+#spring.application.name=service-consumer-2023
+#management.endpoints.web.exposure.include=*
+#spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
+#spring.cloud.nacos.config.server-addr=127.0.0.1:8848
+#spring.cloud.nacos.discovery.fail-fast=true
+#spring.cloud.nacos.discovery.enabled=true
+#spring.cloud.nacos.config.enabled=true
+#spring.cloud.nacos.username=nacos
+#spring.cloud.nacos.password=nacos
+#
+#feign.sentinel.enabled=true
+#
+#spring.cloud.sentinel.transport.dashboard=localhost:8080
+#spring.cloud.sentinel.eager=true
+#
+#spring.cloud.sentinel.datasource.ds1.file.file=classpath: flowrule.json
+#spring.cloud.sentinel.datasource.ds1.file.data-type=json
+#spring.cloud.sentinel.datasource.ds1.file.rule-type=flow
+#
+#spring.cloud.sentinel.datasource.ds2.file.file=classpath: degraderule.json
+#spring.cloud.sentinel.datasource.ds2.file.data-type=json
+#spring.cloud.sentinel.datasource.ds2.file.rule-type=degrade
+#spring.cloud.loadbalancer.nacos.enabled=true
+## use feign client in GraalVM environment need to set below config
+#spring.cloud.refresh.enabled=false
+#spring.main.allow-circular-references=true
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/application.yaml b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/application.yaml
deleted file mode 100644
index 2ab5384b..00000000
--- a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/application.yaml
+++ /dev/null
@@ -1,32 +0,0 @@
-#server:
-# port: 65101
-#
-#spring:
-# application:
-# name: service-consumer-2023
-# cloud:
-# nacos:
-# discovery:
-# enabled: false
-# server-addr: 127.0.0.1:8848
-# config:
-# enabled: false
-# serverAddr: 127.0.0.1:8848
-# username: 'nacos'
-# password: 'nacos'
-# main:
-# allow-bean-definition-overriding: true
-## config:
-## import:
-## - nacos:service-consumer-2023.properties?refreshEnabled=true
-#management:
-# endpoint:
-# health:
-# show-details: always
-# endpoints:
-# web:
-# exposure:
-# include: '*'
-#logging:
-# level:
-# com.alibaba.cloud.nacos.configdata: debug
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/bootstrap.properties b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/bootstrap.properties
new file mode 100644
index 00000000..3e476d36
--- /dev/null
+++ b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/bootstrap.properties
@@ -0,0 +1,15 @@
+server.port=65002
+spring.application.name=service-consumer-2023
+management.endpoints.web.exposure.include=*
+spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
+spring.cloud.nacos.config.server-addr=127.0.0.1:8848
+spring.cloud.nacos.discovery.fail-fast=true
+spring.cloud.nacos.discovery.enabled=true
+spring.cloud.nacos.config.enabled=true
+spring.cloud.nacos.username=nacos
+spring.cloud.nacos.password=nacos
+
+spring.cloud.loadbalancer.nacos.enabled=true
+# use feign client in GraalVM environment need to set below config
+spring.cloud.refresh.enabled=false
+spring.main.allow-circular-references=true
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/bootstrap.yaml b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/bootstrap.yaml
deleted file mode 100644
index ea29f285..00000000
--- a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/consumer/src/main/resources/bootstrap.yaml
+++ /dev/null
@@ -1,32 +0,0 @@
-server:
- port: 65101
-
-spring:
- application:
- name: service-consumer-2023
- cloud:
- nacos:
- discovery:
- enabled: false
- server-addr: 127.0.0.1:8848
- config:
- enabled: false
- serverAddr: 127.0.0.1:8848
- username: 'nacos'
- password: 'nacos'
- main:
- allow-bean-definition-overriding: true
-# config:
-# import:
-# - nacos:service-consumer-2023.properties?refreshEnabled=true
-management:
- endpoint:
- health:
- show-details: always
- endpoints:
- web:
- exposure:
- include: '*'
-logging:
- level:
- com.alibaba.cloud.nacos.configdata: debug
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/application.properties b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/application.properties
new file mode 100644
index 00000000..29dbdc7b
--- /dev/null
+++ b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/application.properties
@@ -0,0 +1,18 @@
+server.port=65001
+spring.application.name=service-provider-2022
+spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
+spring.cloud.nacos.config.server-addr=127.0.0.1:8848
+spring.cloud.nacos.config.enabled=true
+spring.cloud.nacos.discovery.enabled=true
+#spring.cloud.nacos.discovery.instance-enabled=true
+#only register IPv4 instance
+#spring.cloud.nacos.discovery.ip-type=IPv4
+#only register IPv6 instance
+#spring.cloud.nacos.discovery.ip-type=IPv6
+
+spring.cloud.nacos.username=nacos
+spring.cloud.nacos.password=nacos
+
+management.endpoints.web.exposure.include=*
+management.endpoint.health.show-details=always
+spring.main.allow-circular-references=true
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/application.yaml b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/application.yaml
deleted file mode 100644
index 649a698f..00000000
--- a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/application.yaml
+++ /dev/null
@@ -1,32 +0,0 @@
-server:
- port: 65100
-
-spring:
- application:
- name: service-provider-2023
- cloud:
- nacos:
- username: 'nacos'
- password: 'nacos'
- discovery:
- enabled: false
- server-addr: 127.0.0.1:8848
- config:
- enabled: false
- serverAddr: 127.0.0.1:8848
- username: 'nacos'
- password: 'nacos'
-# config:
-# import:
-# - nacos:service-provider-2023.properties?refreshEnabled=true
-management:
- endpoint:
- health:
- show-details: always
- endpoints:
- web:
- exposure:
- include: '*'
-logging:
- level:
- com.alibaba.cloud.nacos.configdata: debug
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/bootstrap.properties b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/bootstrap.properties
new file mode 100644
index 00000000..b45f00e2
--- /dev/null
+++ b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/bootstrap.properties
@@ -0,0 +1,18 @@
+#server.port=65001
+#spring.application.name=service-provider-2022
+#spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
+#spring.cloud.nacos.config.server-addr=127.0.0.1:8848
+#spring.cloud.nacos.config.enabled=true
+#spring.cloud.nacos.discovery.enabled=true
+##spring.cloud.nacos.discovery.instance-enabled=true
+##only register IPv4 instance
+##spring.cloud.nacos.discovery.ip-type=IPv4
+##only register IPv6 instance
+##spring.cloud.nacos.discovery.ip-type=IPv6
+#
+#spring.cloud.nacos.username=nacos
+#spring.cloud.nacos.password=nacos
+#
+#management.endpoints.web.exposure.include=*
+#management.endpoint.health.show-details=always
+#spring.main.allow-circular-references=true
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/bootstrap.yaml b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/bootstrap.yaml
deleted file mode 100644
index 96483e5c..00000000
--- a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider/src/main/resources/bootstrap.yaml
+++ /dev/null
@@ -1,32 +0,0 @@
-#server:
-# port: 65100
-#
-#spring:
-# application:
-# name: service-provider-2023
-# cloud:
-# nacos:
-# username: 'nacos'
-# password: 'nacos'
-# discovery:
-# enabled: false
-# server-addr: 127.0.0.1:8848
-# config:
-# enabled: false
-# serverAddr: 127.0.0.1:8848
-# username: 'nacos'
-# password: 'nacos'
-## config:
-## import:
-## - nacos:service-provider-2023.properties?refreshEnabled=true
-#management:
-# endpoint:
-# health:
-# show-details: always
-# endpoints:
-# web:
-# exposure:
-# include: '*'
-#logging:
-# level:
-# com.alibaba.cloud.nacos.configdata: debug
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-hoxton-examples/quickstart-examples/consumer/src/main/resources/application.properties b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-hoxton-examples/quickstart-examples/consumer/src/main/resources/application.properties
index a28035ac..b55e2a10 100644
--- a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-hoxton-examples/quickstart-examples/consumer/src/main/resources/application.properties
+++ b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-hoxton-examples/quickstart-examples/consumer/src/main/resources/application.properties
@@ -1,5 +1,14 @@
-server.port=65002
spring.application.name=service-consumer-hoxton
+server.port=18083
+management.endpoints.web.exposure.include=*
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
-spring.cloud.nacos.discovery.enabled=false
-spring.cloud.nacos.config.enabled=false
\ No newline at end of file
+spring.cloud.nacos.config.server-addr=127.0.0.1:8848
+spring.cloud.nacos.discovery.fail-fast=true
+spring.cloud.nacos.config.enabled=true
+spring.cloud.nacos.discovery.enabled=true
+spring.cloud.nacos.username=nacos
+spring.cloud.nacos.password=nacos
+
+
+# use feign client in GraalVM environment need to set below config
+spring.cloud.refresh.enabled=false
\ No newline at end of file
diff --git a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-hoxton-examples/quickstart-examples/provider-a/src/main/resources/application.properties b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-hoxton-examples/quickstart-examples/provider-a/src/main/resources/application.properties
index e804caa8..5cf6fe94 100644
--- a/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-hoxton-examples/quickstart-examples/provider-a/src/main/resources/application.properties
+++ b/polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-hoxton-examples/quickstart-examples/provider-a/src/main/resources/application.properties
@@ -1,9 +1,17 @@
-server.port=65001
+server.port=0
spring.application.name=service-provider-hoxton
+spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
-spring.cloud.nacos.config.enabled=false
-spring.cloud.nacos.discovery.enabled=false
+spring.cloud.nacos.config.enabled=true
+spring.cloud.nacos.discovery.enabled=true
+#spring.cloud.nacos.discovery.instance-enabled=true
+#only register IPv4 instance
+#spring.cloud.nacos.discovery.ip-type=IPv4
+#only register IPv6 instance
+#spring.cloud.nacos.discovery.ip-type=IPv6
+
spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos
+
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
\ No newline at end of file
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2020-plugin/pom.xml b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2020-plugin/pom.xml
index 315e5069..e1e99544 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2020-plugin/pom.xml
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2020-plugin/pom.xml
@@ -90,12 +90,10 @@
org.springframework.cloud
spring-cloud-starter-openfeign
- provided
org.springframework.cloud
spring-cloud-loadbalancer
- provided
org.springframework.cloud
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2021-plugin/pom.xml b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2021-plugin/pom.xml
index e9eb1b26..9f30332b 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2021-plugin/pom.xml
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2021-plugin/pom.xml
@@ -90,12 +90,10 @@
org.springframework.cloud
spring-cloud-starter-openfeign
- provided
org.springframework.cloud
spring-cloud-loadbalancer
- provided
org.springframework.cloud
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/pom.xml b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/pom.xml
index e4455c4d..61369dba 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/pom.xml
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/pom.xml
@@ -86,12 +86,10 @@
org.springframework.cloud
spring-cloud-starter-openfeign
- provided
org.springframework.cloud
spring-cloud-loadbalancer
- provided
org.springframework.cloud
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/conf/plugin/spring-cloud-2022/application.properties b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/conf/plugin/spring-cloud-2022/application.properties
index adc85b8b..44adfa4f 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/conf/plugin/spring-cloud-2022/application.properties
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/conf/plugin/spring-cloud-2022/application.properties
@@ -1,5 +1,5 @@
# the application name for spring cloud, register as the service name in registry center
-spring.application.name=service-provider-2022
+spring.application.name=application-name
# polaris server address
spring.cloud.polaris.address=grpc\://106.55.74.24\:8091
# switch for spring cloud polaris all features
@@ -41,5 +41,12 @@ spring.cloud.polaris.stat.enabled=false
spring.cloud.polaris.stat.port=0
# path for polaris stat
spring.cloud.polaris.stat.path=/metrics
-
-logging.level.root=INFO
\ No newline at end of file
+logging.level.root=INFO
+# switch for nacos discovery enable
+spring.cloud.nacos.discovery.enabled=false
+# switch for nacos config enable
+spring.cloud.nacos.config.enabled=false
+# switch for lossless enable
+spring.cloud.polaris.lossless.enabled=true
+spring.cloud.polaris.lossless.port=28080
+spring.cloud.polaris.lossless.delayRegisterInterval=30000
\ No newline at end of file
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/MetadataTransferBeanInjector.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/MetadataTransferBeanInjector.java
index 8ae77b18..fe1cabd8 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/MetadataTransferBeanInjector.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/MetadataTransferBeanInjector.java
@@ -50,14 +50,15 @@ public String getModule() {
@Override
public void onApplicationStartup(Object configurationParser, Constructor> configClassCreator, Method processConfigurationClass, BeanDefinitionRegistry registry, Environment environment) {
LOGGER.info("[PolarisJavaAgent] success to inject application bean definitions for module {}", getModule());
- }
-
- @Override
- public void onBootstrapStartup(Object configurationParser, Constructor> configClassCreator, Method processConfigurationClass, BeanDefinitionRegistry registry, Environment environment) {
Object metadataTransferAutoConfiguration = ReflectionUtils.invokeConstructor(configClassCreator, MetadataTransferAutoConfiguration.class, "metadataTransferAutoConfiguration");
ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, metadataTransferAutoConfiguration, Constant.DEFAULT_EXCLUSION_FILTER);
registry.registerBeanDefinition("metadataTransferAutoConfiguration", BeanDefinitionBuilder.genericBeanDefinition(
MetadataTransferAutoConfiguration.class).getBeanDefinition());
}
+ @Override
+ public void onBootstrapStartup(Object configurationParser, Constructor> configClassCreator, Method processConfigurationClass, BeanDefinitionRegistry registry, Environment environment) {
+
+ }
+
}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/RegisterBeanInterceptor.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/RegisterBeanInterceptor.java
index ba15a1dc..99454caa 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/RegisterBeanInterceptor.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2022-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/RegisterBeanInterceptor.java
@@ -33,7 +33,9 @@ public class RegisterBeanInterceptor implements Interceptor {
private final Set primaryBeanNames = new HashSet<>();
public RegisterBeanInterceptor() {
-// primaryBeanNames.add("metadataTransferAutoConfiguratio");
+ primaryBeanNames.add("polarisAutoServiceRegistration");
+ primaryBeanNames.add("polarisRegistration");
+ primaryBeanNames.add("polarisServiceRegistry");
}
@Override
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/pom.xml b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/pom.xml
index 59d6b32b..7f97df10 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/pom.xml
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/pom.xml
@@ -86,12 +86,10 @@
org.springframework.cloud
spring-cloud-starter-openfeign
- provided
org.springframework.cloud
spring-cloud-loadbalancer
- provided
org.springframework.cloud
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/CommonBeanInjector.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/CommonBeanInjector.java
index 4fb14366..7c990b41 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/CommonBeanInjector.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/CommonBeanInjector.java
@@ -65,17 +65,7 @@ public void onApplicationStartup(Object configurationParser, Constructor> conf
ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, applicationContextAwareUtils, Constant.DEFAULT_EXCLUSION_FILTER);
registry.registerBeanDefinition("applicationContextAwareUtils", BeanDefinitionBuilder.genericBeanDefinition(
ApplicationContextAwareUtils.class).getBeanDefinition());
- if (null != ClassUtils.getClazz("feign.RequestInterceptor",
- Thread.currentThread().getContextClassLoader())) {
- Object feignAutoConfiguration = ReflectionUtils.invokeConstructor(configClassCreator, FeignAutoConfiguration.class, "feignAutoConfiguration");
- ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, feignAutoConfiguration, Constant.DEFAULT_EXCLUSION_FILTER);
- registry.registerBeanDefinition("feignAutoConfiguration", BeanDefinitionBuilder.genericBeanDefinition(
- FeignAutoConfiguration.class).getBeanDefinition());
- }
- Object routerAutoConfiguration = ReflectionUtils.invokeConstructor(configClassCreator, RouterAutoConfiguration.class, "routerAutoConfiguration");
- ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, routerAutoConfiguration, Constant.DEFAULT_EXCLUSION_FILTER);
- registry.registerBeanDefinition("routerAutoConfiguration", BeanDefinitionBuilder.genericBeanDefinition(
- RouterAutoConfiguration.class).getBeanDefinition());
+
LOGGER.info("[PolarisJavaAgent] success to inject application bean definitions for module {}", getModule());
}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/RouterBeanInjector.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/RouterBeanInjector.java
index 758cebce..e8d0c87b 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/RouterBeanInjector.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/inject/RouterBeanInjector.java
@@ -58,6 +58,25 @@ public String getModule() {
@Override
public void onBootstrapStartup(Object configurationParser, Constructor> configClassCreator, Method processConfigurationClass, BeanDefinitionRegistry registry, Environment environment) {
+ LOGGER.info("[PolarisJavaAgent] success to inject bootstrap bean definitions for module {}", getModule());
+ }
+
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void onApplicationStartup(Object configurationParser, Constructor> configClassCreator, Method processConfigurationClass, BeanDefinitionRegistry registry, Environment environment) {
+ LOGGER.info("[PolarisJavaAgent] success to inject application bean definitions for module {}", getModule());
+ if (null != ClassUtils.getClazz("feign.RequestInterceptor",
+ Thread.currentThread().getContextClassLoader())) {
+ Object feignAutoConfiguration = ReflectionUtils.invokeConstructor(configClassCreator, FeignAutoConfiguration.class, "feignAutoConfiguration");
+ ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, feignAutoConfiguration, Constant.DEFAULT_EXCLUSION_FILTER);
+ registry.registerBeanDefinition("feignAutoConfiguration", BeanDefinitionBuilder.genericBeanDefinition(
+ FeignAutoConfiguration.class).getBeanDefinition());
+ }
+ Object routerAutoConfiguration = ReflectionUtils.invokeConstructor(configClassCreator, RouterAutoConfiguration.class, "routerAutoConfiguration");
+ ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, routerAutoConfiguration, Constant.DEFAULT_EXCLUSION_FILTER);
+ registry.registerBeanDefinition("routerAutoConfiguration", BeanDefinitionBuilder.genericBeanDefinition(
+ RouterAutoConfiguration.class).getBeanDefinition());
Object polarisNearByRouterProperties = ReflectionUtils.invokeConstructor(configClassCreator, PolarisNearByRouterProperties.class, "polarisNearByRouterProperties");
ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, polarisNearByRouterProperties, Constant.DEFAULT_EXCLUSION_FILTER);
registry.registerBeanDefinition("polarisNearByRouterProperties", BeanDefinitionBuilder.genericBeanDefinition(
@@ -78,13 +97,5 @@ public void onBootstrapStartup(Object configurationParser, Constructor> config
ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, polarisContractPropertiesAutoConfiguration, Constant.DEFAULT_EXCLUSION_FILTER);
registry.registerBeanDefinition("polarisContractPropertiesAutoConfiguration", BeanDefinitionBuilder.genericBeanDefinition(
PolarisContractPropertiesAutoConfiguration.class).getBeanDefinition());
- LOGGER.info("[PolarisJavaAgent] success to inject bootstrap bean definitions for module {}", getModule());
- }
-
-
- @Override
- @SuppressWarnings("unchecked")
- public void onApplicationStartup(Object configurationParser, Constructor> configClassCreator, Method processConfigurationClass, BeanDefinitionRegistry registry, Environment environment) {
- LOGGER.info("[PolarisJavaAgent] success to inject application bean definitions for module {}", getModule());
}
}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationParserInterceptor.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationParserInterceptor.java
index 5213a6ed..2c56dbb3 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationParserInterceptor.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/interceptor/ConfigurationParserInterceptor.java
@@ -117,7 +117,7 @@ public void after(Object target, Object[] args, Object result, Throwable throwab
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) ReflectionUtils.getObjectByFieldName(target, "registry");
Environment environment = (Environment) ReflectionUtils.getObjectByFieldName(target, "environment");
for (BeanInjector beanInjector : beanInjectors) {
- if (!(beanInjector instanceof CommonBeanInjector)) {
+ if (!(beanInjector instanceof RouterBeanInjector)) {
LOGGER.info("[PolarisJavaAgent] start to inject application bean definitions in module {}", beanInjector.getModule());
beanInjector.onApplicationStartup(target, constructor, processConfigurationClass, registry, environment);
}
@@ -140,7 +140,7 @@ public void before(Object target, Object[] args) {
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) ReflectionUtils.getObjectByFieldName(target, "registry");
Environment environment = (Environment) ReflectionUtils.getObjectByFieldName(target, "environment");
for (BeanInjector beanInjector : beanInjectors) {
- if (beanInjector instanceof CommonBeanInjector) {
+ if (beanInjector instanceof RouterBeanInjector) {
LOGGER.info("[PolarisJavaAgent] start to inject application bean definitions in module {}", beanInjector.getModule());
beanInjector.onApplicationStartup(target, constructor, processConfigurationClass, registry, environment);
}
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-hoxton-plugin/pom.xml b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-hoxton-plugin/pom.xml
index ec2888bc..5345f013 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-hoxton-plugin/pom.xml
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-hoxton-plugin/pom.xml
@@ -91,12 +91,10 @@
org.springframework.cloud
spring-cloud-starter-openfeign
- provided
org.springframework.cloud
spring-cloud-loadbalancer
- provided
org.springframework.cloud
diff --git a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-plugin-common/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/common/PropertiesProvider.java b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-plugin-common/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/common/PropertiesProvider.java
index 542faee0..9f9251a6 100644
--- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-plugin-common/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/common/PropertiesProvider.java
+++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-plugin-common/src/main/java/cn/polarismesh/agent/plugin/spring/cloud/common/PropertiesProvider.java
@@ -17,6 +17,10 @@
package cn.polarismesh.agent.plugin.spring.cloud.common;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.env.PropertiesPropertySource;
+
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
@@ -27,50 +31,47 @@
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.core.env.PropertiesPropertySource;
-
public class PropertiesProvider {
- private static final Logger LOGGER = LoggerFactory.getLogger(PropertiesProvider.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(PropertiesProvider.class);
- private static final Map> LOADED_RESOURCES = new ConcurrentHashMap<>();
+ private static final Map> LOADED_RESOURCES = new ConcurrentHashMap<>();
- private static final String CONFIG_FILE_NAME = "default-plugin.conf";
+ private static final String CONFIG_FILE_NAME = "default-plugin.conf";
- /**
- * load the properties source from default application.yaml
- * @return propertySources
- */
- public static List loadPropertiesSource() {
- return LOADED_RESOURCES.computeIfAbsent(CONFIG_FILE_NAME, fileName -> {
- InputStream stream = PropertiesProvider.class.getClassLoader().getResourceAsStream(fileName);
- Properties defaultProperties = new Properties();
- try {
- defaultProperties.load(stream);
- } catch (IOException e) {
- throw new IllegalStateException("fail to load file " + fileName, e);
- }
- List propertySources = new ArrayList<>();
- String configPath = Paths.get(System.getProperty(Constant.AGENT_CONF_PATH), "conf").toString();
- LOGGER.info("load property sources from config path " + configPath);
- Properties properties = new Properties();
- String confPath = Paths.get(configPath, "plugin", "spring-cloud-2022", "application.properties").toString();
- String cmdVal = System.getProperty("polaris.agent.user.application.conf");
- if (null != cmdVal && !cmdVal.isEmpty()) {
- confPath = cmdVal;
- }
- try {
- properties.load(Files.newInputStream(Paths.get(confPath).toFile().toPath()));
- }
- catch (IOException e) {
- throw new IllegalStateException("fail to load config from " + configPath, e);
- }
- propertySources.add(new PropertiesPropertySource("__polaris_agent_spring_cloud_tencent__", properties));
- propertySources.add(new PropertiesPropertySource("__default_polaris_agent_spring_cloud_tencent__", defaultProperties));
- return propertySources;
- });
- }
+ /**
+ * load the properties source from default application.yaml
+ *
+ * @return propertySources
+ */
+ public static List loadPropertiesSource() {
+ return LOADED_RESOURCES.computeIfAbsent(CONFIG_FILE_NAME, fileName -> {
+ InputStream stream = PropertiesProvider.class.getClassLoader().getResourceAsStream(fileName);
+ Properties defaultProperties = new Properties();
+ try {
+ defaultProperties.load(stream);
+ } catch (IOException e) {
+ throw new IllegalStateException("fail to load file " + fileName, e);
+ }
+ List propertySources = new ArrayList<>();
+ String configPath = Paths.get(System.getProperty(Constant.AGENT_CONF_PATH), "conf").toString();
+ LOGGER.info("load property sources from config path " + configPath);
+ Properties properties = new Properties();
+ String confPath = Paths.get(configPath, "plugin", "spring-cloud-2022", "application.properties").toString();
+ String cmdVal = System.getProperty("polaris.agent.user.application.conf");
+ if (null != cmdVal && !cmdVal.isEmpty()) {
+ confPath = cmdVal;
+ }
+ try {
+ properties.load(Files.newInputStream(Paths.get(confPath).toFile().toPath()));
+ } catch (IOException e) {
+ throw new IllegalStateException("fail to load config from " + configPath, e);
+ }
+ properties.setProperty("spring.cloud.nacos.config.enabled", "false");
+ properties.setProperty("spring.cloud.nacos.discovery.enabled", "false");
+ propertySources.add(new PropertiesPropertySource("__polaris_agent_spring_cloud_tencent__", properties));
+ propertySources.add(new PropertiesPropertySource("__default_polaris_agent_spring_cloud_tencent__", defaultProperties));
+ return propertySources;
+ });
+ }
}