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 664d5d3c..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 @@ -2,23 +2,13 @@ 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.fail-fast=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 -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 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 672e7e8e..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,6 +1,8 @@ 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 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 8555929f..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: true - server-addr: 127.0.0.1:8848 - config: - enabled: true - 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 fbf160f0..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: true - server-addr: 127.0.0.1:8848 - config: - enabled: true - 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 a0dd8275..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 @@ -2,23 +2,13 @@ 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.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 -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 \ 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 3cfbe8b5..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,6 +1,8 @@ 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=true spring.cloud.nacos.discovery.enabled=true #spring.cloud.nacos.discovery.instance-enabled=true #only register IPv4 instance 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-plugin-common/src/main/conf/plugin/spring-cloud/application.properties b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-plugin-common/src/main/conf/plugin/spring-cloud/application.properties index d171d2dc..44adfa4f 100644 --- a/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-plugin-common/src/main/conf/plugin/spring-cloud/application.properties +++ b/polaris-agent-plugins/spring-cloud-plugins/spring-cloud-plugin-common/src/main/conf/plugin/spring-cloud/application.properties @@ -45,4 +45,8 @@ 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 \ No newline at end of file +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-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 015fed4b..f4aa3d60 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 @@ -67,6 +67,8 @@ public static List loadPropertiesSource() { } 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;