diff --git a/CHANGELOG.md b/CHANGELOG.md
index daf24404e..c2518b95f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,4 +29,5 @@
- [feat:support polaris event.](https://github.com/Tencent/spring-cloud-tencent/pull/1543)
- [feat:support circuit breaker metrics reporting.](https://github.com/Tencent/spring-cloud-tencent/pull/1544)
- [feat: support gateway context, feign eager-load support default value.](https://github.com/Tencent/spring-cloud-tencent/pull/1545)
+- [feat:use polaris-all for shading third-party dependencies.](https://github.com/Tencent/spring-cloud-tencent/pull/1549)
diff --git a/pom.xml b/pom.xml
index 6905732c9..ec1c75086 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,7 +108,8 @@
3.2.0
1.2.7
3.0.1
- 3.4.1
+ 3.5.1
+ 3.4.0
true
@@ -166,6 +167,38 @@
+
+
+ org.slf4j
+ slf4j-api
+ provided
+
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ uk.org.webcompere
+ system-stubs-jupiter
+ test
+
+
+
+ io.projectreactor
+ reactor-test
+ test
+
+
+
@@ -179,6 +212,11 @@
maven-shade-plugin
${maven-shade-plugin.version}
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+ ${maven-clean-plugin.version}
+
@@ -186,6 +224,20 @@
org.apache.maven.plugins
maven-checkstyle-plugin
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+
+
+
+ ${project.basedir}
+
+ dependency-reduced-pom.xml
+
+
+
+
+
org.apache.maven.plugins
maven-compiler-plugin
diff --git a/spring-cloud-starter-tencent-all/pom.xml b/spring-cloud-starter-tencent-all/pom.xml
index b4c07bf58..c8a70ee68 100644
--- a/spring-cloud-starter-tencent-all/pom.xml
+++ b/spring-cloud-starter-tencent-all/pom.xml
@@ -68,83 +68,6 @@
com.tencent.cloud
spring-cloud-starter-tencent-fault-tolerance
-
-
- org.springframework.boot
- spring-boot-starter-logging
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
-
- attach-javadocs
- package
-
- jar
-
-
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
-
- false
-
-
-
- sct-all-shade
-
- shade
-
-
- true
-
-
- *:*
-
- META-INF/*.MF
- META-INF/NOTICE
- META-INF/DEPENDENCIES
- META-INF/LICENSE
- META-INF/NOTICE.txt
- META-INF/*.SF
- META-INF/*.DSA
- META-INF/*.RSA
- META-INF/*.RSA
- META-INF/io.netty.versions.properties
- module-info.java
- module-info.class
-
-
-
-
-
-
-
- META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports
-
-
-
-
- META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
-
-
-
-
-
-
-
-
-
diff --git a/spring-cloud-starter-tencent-metadata-transfer/pom.xml b/spring-cloud-starter-tencent-metadata-transfer/pom.xml
index 34658ad47..86a43d3f9 100644
--- a/spring-cloud-starter-tencent-metadata-transfer/pom.xml
+++ b/spring-cloud-starter-tencent-metadata-transfer/pom.xml
@@ -19,7 +19,6 @@
com.tencent.cloud
spring-cloud-tencent-rpc-enhancement
-
@@ -46,35 +45,11 @@
true
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
org.springframework.cloud
spring-cloud-starter-netflix-ribbon
test
-
-
- com.tencent.polaris
- polaris-test-mock-discovery
- test
-
-
-
- com.tencent.polaris
- polaris-test-common
- test
-
-
-
- org.mockito
- mockito-inline
- test
-
diff --git a/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/CustomTransitiveMetadataResolver.java b/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/CustomTransitiveMetadataResolver.java
index 392f4c6da..945abc5ac 100644
--- a/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/CustomTransitiveMetadataResolver.java
+++ b/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/CustomTransitiveMetadataResolver.java
@@ -25,10 +25,10 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.tencent.cloud.common.constant.MetadataConstant;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import org.springframework.http.HttpHeaders;
-import org.springframework.util.CollectionUtils;
import org.springframework.web.server.ServerWebExchange;
/**
diff --git a/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataFeignEnhancedPlugin.java b/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataFeignEnhancedPlugin.java
index 30f71ea2e..8bc34cff0 100644
--- a/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataFeignEnhancedPlugin.java
+++ b/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataFeignEnhancedPlugin.java
@@ -22,7 +22,6 @@ import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
-import com.google.common.collect.ImmutableMap;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.metadata.MetadataContextHolder;
import com.tencent.cloud.common.util.JacksonUtils;
@@ -35,6 +34,7 @@ import com.tencent.cloud.rpc.enhancement.plugin.PluginOrderConstant;
import com.tencent.polaris.metadata.core.MessageMetadataContainer;
import com.tencent.polaris.metadata.core.MetadataType;
import feign.Request;
+import shade.polaris.com.google.common.collect.ImmutableMap;
import org.springframework.util.CollectionUtils;
diff --git a/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataRestTemplateEnhancedPlugin.java b/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataRestTemplateEnhancedPlugin.java
index 0f68dc23d..d94a28e70 100644
--- a/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataRestTemplateEnhancedPlugin.java
+++ b/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataRestTemplateEnhancedPlugin.java
@@ -19,7 +19,6 @@ package com.tencent.cloud.metadata.core;
import java.util.Map;
-import com.google.common.collect.ImmutableMap;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.metadata.MetadataContextHolder;
import com.tencent.cloud.common.util.JacksonUtils;
@@ -30,6 +29,7 @@ import com.tencent.cloud.rpc.enhancement.plugin.EnhancedPluginType;
import com.tencent.cloud.rpc.enhancement.plugin.PluginOrderConstant;
import com.tencent.polaris.metadata.core.MessageMetadataContainer;
import com.tencent.polaris.metadata.core.MetadataType;
+import shade.polaris.com.google.common.collect.ImmutableMap;
import org.springframework.http.HttpRequest;
import org.springframework.util.CollectionUtils;
diff --git a/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataScgEnhancedPlugin.java b/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataScgEnhancedPlugin.java
index 5f56e3686..64e8b7ede 100644
--- a/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataScgEnhancedPlugin.java
+++ b/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataScgEnhancedPlugin.java
@@ -19,7 +19,6 @@ package com.tencent.cloud.metadata.core;
import java.util.Map;
-import com.google.common.collect.ImmutableMap;
import com.tencent.cloud.common.constant.MetadataConstant;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.metadata.MetadataContextHolder;
@@ -31,6 +30,7 @@ import com.tencent.cloud.rpc.enhancement.plugin.EnhancedPluginType;
import com.tencent.cloud.rpc.enhancement.plugin.PluginOrderConstant;
import com.tencent.polaris.metadata.core.MessageMetadataContainer;
import com.tencent.polaris.metadata.core.MetadataType;
+import shade.polaris.com.google.common.collect.ImmutableMap;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.util.CollectionUtils;
diff --git a/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataWebClientEnhancedPlugin.java b/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataWebClientEnhancedPlugin.java
index 8713f8a5b..4b3109a65 100644
--- a/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataWebClientEnhancedPlugin.java
+++ b/spring-cloud-starter-tencent-metadata-transfer/src/main/java/com/tencent/cloud/metadata/core/EncodeTransferMedataWebClientEnhancedPlugin.java
@@ -19,7 +19,6 @@ package com.tencent.cloud.metadata.core;
import java.util.Map;
-import com.google.common.collect.ImmutableMap;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.metadata.MetadataContextHolder;
import com.tencent.cloud.common.util.JacksonUtils;
@@ -30,6 +29,7 @@ import com.tencent.cloud.rpc.enhancement.plugin.EnhancedPluginType;
import com.tencent.cloud.rpc.enhancement.plugin.PluginOrderConstant;
import com.tencent.polaris.metadata.core.MessageMetadataContainer;
import com.tencent.polaris.metadata.core.MetadataType;
+import shade.polaris.com.google.common.collect.ImmutableMap;
import org.springframework.util.CollectionUtils;
import org.springframework.web.reactive.function.client.ClientRequest;
diff --git a/spring-cloud-starter-tencent-polaris-auth/pom.xml b/spring-cloud-starter-tencent-polaris-auth/pom.xml
index c3fe3df23..cd5f604fc 100644
--- a/spring-cloud-starter-tencent-polaris-auth/pom.xml
+++ b/spring-cloud-starter-tencent-polaris-auth/pom.xml
@@ -14,47 +14,12 @@
-
- com.tencent.cloud
- spring-cloud-tencent-rpc-enhancement
-
-
com.tencent.cloud
spring-cloud-starter-tencent-metadata-transfer
-
-
- com.tencent.polaris
- polaris-auth-factory
-
-
-
- com.tencent.polaris
- auth-block-allow-list
-
-
-
- com.tencent.polaris
- polaris-test-common
- test
-
-
-
- com.tencent.polaris
- polaris-test-mock-discovery
- test
-
-
- junit
- junit
-
-
-
-
-
org.springframework.boot
spring-boot-starter-web
@@ -67,12 +32,6 @@
true
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
org.springframework.boot
spring-boot-actuator
@@ -84,23 +43,5 @@
spring-boot-actuator-autoconfigure
true
-
-
- org.mockito
- mockito-inline
- test
-
-
-
- org.mockito
- mockito-core
- test
-
-
-
- net.bytebuddy
- byte-buddy
- test
-
\ No newline at end of file
diff --git a/spring-cloud-starter-tencent-polaris-circuitbreaker/pom.xml b/spring-cloud-starter-tencent-polaris-circuitbreaker/pom.xml
index 7525a4c92..5fd9e8fb8 100644
--- a/spring-cloud-starter-tencent-polaris-circuitbreaker/pom.xml
+++ b/spring-cloud-starter-tencent-polaris-circuitbreaker/pom.xml
@@ -14,6 +14,12 @@
+
+ com.tencent.cloud
+ spring-cloud-tencent-rpc-enhancement
+
+
+
org.springframework.boot
spring-boot-starter-web
@@ -37,75 +43,11 @@
spring-cloud-starter-gateway
true
-
org.springframework.cloud
spring-cloud-starter-netflix-zuul
true
-
-
- com.tencent.cloud
- spring-cloud-tencent-rpc-enhancement
-
-
-
-
-
- com.tencent.polaris
- polaris-circuitbreaker-factory
-
-
- com.tencent.polaris
- router-rule
-
-
- com.tencent.polaris
- router-nearby
-
-
- com.tencent.polaris
- router-namespace
-
-
- com.tencent.polaris
- router-metadata
-
-
- com.tencent.polaris
- router-canary
-
-
- com.tencent.polaris
- router-set
-
-
- com.tencent.polaris
- router-isolated
-
-
- com.tencent.polaris
- router-healthy
-
-
-
-
-
- com.tencent.polaris
- healthchecker-http
-
-
-
- com.tencent.polaris
- healthchecker-udp
-
-
-
- com.tencent.polaris
- healthchecker-tcp
-
-
-
org.springframework.boot
spring-boot-actuator
@@ -117,35 +59,5 @@
spring-boot-actuator-autoconfigure
true
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- com.tencent.polaris
- polaris-test-common
- test
-
-
-
- com.tencent.polaris
- polaris-test-mock-discovery
- test
-
-
-
- org.mockito
- mockito-inline
- test
-
-
-
- io.projectreactor
- reactor-test
- test
-
diff --git a/spring-cloud-starter-tencent-polaris-circuitbreaker/src/main/java/com/tencent/cloud/polaris/circuitbreaker/endpoint/PolarisCircuitBreakerEndpoint.java b/spring-cloud-starter-tencent-polaris-circuitbreaker/src/main/java/com/tencent/cloud/polaris/circuitbreaker/endpoint/PolarisCircuitBreakerEndpoint.java
index 35f9c7cd3..98ddb98c0 100644
--- a/spring-cloud-starter-tencent-polaris-circuitbreaker/src/main/java/com/tencent/cloud/polaris/circuitbreaker/endpoint/PolarisCircuitBreakerEndpoint.java
+++ b/spring-cloud-starter-tencent-polaris-circuitbreaker/src/main/java/com/tencent/cloud/polaris/circuitbreaker/endpoint/PolarisCircuitBreakerEndpoint.java
@@ -22,8 +22,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.util.JsonFormat;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.util.JacksonUtils;
import com.tencent.cloud.polaris.context.ServiceRuleManager;
@@ -31,6 +29,8 @@ import com.tencent.polaris.api.utils.CollectionUtils;
import com.tencent.polaris.specification.api.v1.fault.tolerance.CircuitBreakerProto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import shade.polaris.com.google.protobuf.InvalidProtocolBufferException;
+import shade.polaris.com.google.protobuf.util.JsonFormat;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
diff --git a/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/PolarisCircuitBreakerMockServerTest.java b/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/PolarisCircuitBreakerMockServerTest.java
index 95c34a578..81c3bf7b7 100644
--- a/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/PolarisCircuitBreakerMockServerTest.java
+++ b/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/PolarisCircuitBreakerMockServerTest.java
@@ -27,7 +27,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
-import com.google.protobuf.util.JsonFormat;
import com.tencent.cloud.common.util.ApplicationContextAwareUtils;
import com.tencent.cloud.polaris.circuitbreaker.config.PolarisCircuitBreakerProperties;
import com.tencent.cloud.polaris.context.PolarisSDKContextManager;
@@ -49,6 +48,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
+import shade.polaris.com.google.protobuf.util.JsonFormat;
import org.springframework.cloud.client.circuitbreaker.CircuitBreaker;
diff --git a/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/endpoint/PolarisCircuitBreakerEndpointTest.java b/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/endpoint/PolarisCircuitBreakerEndpointTest.java
index 767978d15..81503e144 100644
--- a/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/endpoint/PolarisCircuitBreakerEndpointTest.java
+++ b/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/endpoint/PolarisCircuitBreakerEndpointTest.java
@@ -19,7 +19,6 @@ package com.tencent.cloud.polaris.circuitbreaker.endpoint;
import java.util.Map;
-import com.google.protobuf.StringValue;
import com.tencent.cloud.common.util.ApplicationContextAwareUtils;
import com.tencent.cloud.polaris.context.ServiceRuleManager;
import com.tencent.polaris.specification.api.v1.fault.tolerance.CircuitBreakerProto;
@@ -28,6 +27,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
+import shade.polaris.com.google.protobuf.StringValue;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
diff --git a/spring-cloud-starter-tencent-polaris-config/pom.xml b/spring-cloud-starter-tencent-polaris-config/pom.xml
index 01c04fb97..5f1a7a46e 100644
--- a/spring-cloud-starter-tencent-polaris-config/pom.xml
+++ b/spring-cloud-starter-tencent-polaris-config/pom.xml
@@ -18,56 +18,19 @@
com.tencent.cloud
spring-cloud-tencent-polaris-context
-
-
-
-
-
- com.tencent.polaris
- polaris-configuration-factory
- com.tencent.polaris
- router-rule
-
-
- com.tencent.polaris
- router-nearby
-
-
- com.tencent.polaris
- router-namespace
-
-
- com.tencent.polaris
- router-metadata
-
-
- com.tencent.polaris
- router-canary
-
-
- com.tencent.polaris
- router-set
-
-
- com.tencent.polaris
- router-isolated
-
-
- com.tencent.polaris
- router-healthy
+ spring-security-crypto
+ org.springframework.security
-
-
-
+
- org.springframework.boot
- spring-boot-starter-test
- test
+ org.springframework
+ spring-web
+ true
@@ -81,23 +44,5 @@
spring-boot-actuator-autoconfigure
true
-
-
- org.mockito
- mockito-inline
- test
-
-
-
- org.mockito
- mockito-core
- test
-
-
-
- net.bytebuddy
- byte-buddy
- test
-
diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/ConfigurationModifier.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/ConfigurationModifier.java
index fa91e36b7..4cd01eb35 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/ConfigurationModifier.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/ConfigurationModifier.java
@@ -28,10 +28,10 @@ import com.tencent.cloud.polaris.config.config.PolarisCryptoConfigProperties;
import com.tencent.cloud.polaris.context.PolarisConfigurationConfigModifier;
import com.tencent.cloud.polaris.context.config.PolarisContextProperties;
import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.factory.config.ConfigurationImpl;
import com.tencent.polaris.factory.config.configuration.ConfigFilterConfigImpl;
import com.tencent.polaris.factory.config.configuration.ConnectorConfigImpl;
-import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -137,8 +137,15 @@ public class ConfigurationModifier implements PolarisConfigurationConfigModifier
List configAddresses = new ArrayList<>(polarisAddresses.size());
for (String address : polarisAddresses) {
- String ip = StringUtils.substringBeforeLast(address, ":");
- configAddresses.add(ip + ":" + polarisConfigProperties.getPort());
+ if (StringUtils.isNotBlank(address)) {
+ int pos = address.lastIndexOf(":");
+ if (pos != -1) {
+ configAddresses.add(address.substring(0, pos) + ":" + polarisConfigProperties.getPort());
+ }
+ else {
+ configAddresses.add(address);
+ }
+ }
}
return configAddresses;
diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java
index 51672a8cb..0a3f5d9e8 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocator.java
@@ -29,12 +29,13 @@ import com.tencent.cloud.polaris.config.config.PolarisConfigProperties;
import com.tencent.cloud.polaris.config.enums.ConfigFileFormat;
import com.tencent.cloud.polaris.context.config.PolarisContextProperties;
import com.tencent.polaris.api.utils.ClassUtils;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.configuration.api.core.ConfigFileMetadata;
import com.tencent.polaris.configuration.api.core.ConfigFileService;
import com.tencent.polaris.configuration.api.core.ConfigKVFile;
import com.tencent.polaris.configuration.client.internal.CompositeConfigFile;
import com.tencent.polaris.configuration.client.internal.DefaultConfigFileMetadata;
-import org.apache.commons.lang.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,8 +44,6 @@ import org.springframework.core.annotation.Order;
import org.springframework.core.env.CompositePropertySource;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertySource;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
/**
* Spring cloud reserved core configuration loading SPI.
@@ -59,19 +58,14 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
private static final Logger LOGGER = LoggerFactory.getLogger(PolarisConfigFileLocator.class);
private static final String POLARIS_CONFIG_PROPERTY_SOURCE_NAME = "polaris-config";
-
+ private volatile static CompositePropertySource compositePropertySourceCache = null;
private final PolarisConfigProperties polarisConfigProperties;
-
private final PolarisContextProperties polarisContextProperties;
-
private final ConfigFileService configFileService;
-
private final Environment environment;
// this class provides customized logic for some customers to configure special business group files
private final PolarisConfigCustomExtensionLayer polarisConfigCustomExtensionLayer = PolarisServiceLoaderUtil.getPolarisConfigCustomExtensionLayer();
- private volatile static CompositePropertySource compositePropertySourceCache = null;
-
public PolarisConfigFileLocator(PolarisConfigProperties polarisConfigProperties,
PolarisContextProperties polarisContextProperties, ConfigFileService configFileService, Environment environment) {
this.polarisConfigProperties = polarisConfigProperties;
@@ -80,6 +74,65 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
this.environment = environment;
}
+ public static PolarisPropertySource loadPolarisPropertySource(ConfigFileService configFileService, String namespace, String group, String fileName) {
+ ConfigKVFile configKVFile = loadConfigKVFile(configFileService, namespace, group, fileName);
+
+ Map map = new ConcurrentHashMap<>();
+ for (String key : configKVFile.getPropertyNames()) {
+ map.put(key, configKVFile.getProperty(key, null));
+ }
+
+ return new PolarisPropertySource(namespace, group, fileName, configKVFile, map);
+ }
+
+ public static PolarisPropertySource loadGroupPolarisPropertySource(ConfigFileService configFileService, String namespace, String group) {
+ List configKVFiles = new ArrayList<>();
+
+ com.tencent.polaris.configuration.api.core.ConfigFileGroup remoteGroup = configFileService.getConfigFileGroup(namespace, group);
+ if (remoteGroup == null) {
+ return null;
+ }
+
+ for (ConfigFileMetadata configFile : remoteGroup.getConfigFileMetadataList()) {
+ String fileName = configFile.getFileName();
+ ConfigKVFile configKVFile = loadConfigKVFile(configFileService, namespace, group, fileName);
+ configKVFiles.add(configKVFile);
+ }
+
+ CompositeConfigFile compositeConfigFile = new CompositeConfigFile(configKVFiles);
+
+ Map map = new ConcurrentHashMap<>();
+ for (String key : compositeConfigFile.getPropertyNames()) {
+ String value = compositeConfigFile.getProperty(key, null);
+ map.put(key, value);
+ }
+
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("namespace='" + namespace + '\''
+ + ", group='" + group + '\'' + ", fileName='" + compositeConfigFile + '\''
+ + ", map='" + map + '\'');
+ }
+
+ return new PolarisPropertySource(namespace, group, "", compositeConfigFile, map);
+ }
+
+ public static ConfigKVFile loadConfigKVFile(ConfigFileService configFileService, String namespace, String group, String fileName) {
+ ConfigKVFile configKVFile;
+ // unknown extension is resolved as properties file
+ if (ConfigFileFormat.isPropertyFile(fileName) || ConfigFileFormat.isUnknownFile(fileName)) {
+ configKVFile = configFileService.getConfigPropertiesFile(namespace, group, fileName);
+ }
+ else if (ConfigFileFormat.isYamlFile(fileName)) {
+ configKVFile = configFileService.getConfigYamlFile(namespace, group, fileName);
+ }
+ else {
+ LOGGER.warn("[SCT Config] Unsupported config file. namespace = {}, group = {}, fileName = {}", namespace, group, fileName);
+
+ throw new IllegalStateException("Only configuration files in the format of properties / yaml / yaml" + " can be injected into the spring context");
+ }
+ return configKVFile;
+ }
+
/**
* order: spring boot default config files > custom config files > tsf default config group.
* @param environment The current Environment.
@@ -102,7 +155,7 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
initInternalConfigFiles(compositePropertySource);
// load custom config files
List configFileGroups = polarisConfigProperties.getGroups();
- if (!CollectionUtils.isEmpty(configFileGroups)) {
+ if (CollectionUtils.isNotEmpty(configFileGroups)) {
initCustomPolarisConfigFiles(compositePropertySource, configFileGroups);
}
// load tsf default config group
@@ -155,7 +208,7 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
private List getInternalConfigFiles() {
String namespace = polarisContextProperties.getNamespace();
String serviceName = polarisContextProperties.getService();
- if (!StringUtils.hasText(serviceName)) {
+ if (StringUtils.isBlank(serviceName)) {
serviceName = environment.getProperty("spring.application.name");
}
@@ -165,10 +218,10 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
String[] activeProfiles = environment.getActiveProfiles();
String[] defaultProfiles = environment.getDefaultProfiles();
List profileList = new ArrayList<>();
- if (ArrayUtils.isNotEmpty(activeProfiles)) {
+ if (CollectionUtils.isNotEmpty(activeProfiles)) {
profileList.addAll(Arrays.asList(activeProfiles));
}
- else if (ArrayUtils.isNotEmpty(defaultProfiles)) {
+ else if (CollectionUtils.isNotEmpty(defaultProfiles)) {
profileList.addAll(Arrays.asList(defaultProfiles));
}
// build application config files
@@ -181,7 +234,7 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
private void buildInternalApplicationConfigFiles(List internalConfigFiles, String namespace, String serviceName, List profileList) {
for (String profile : profileList) {
- if (!StringUtils.hasText(profile)) {
+ if (StringUtils.isBlank(profile)) {
continue;
}
internalConfigFiles.add(new DefaultConfigFileMetadata(namespace, serviceName, "application-" + profile + ".properties"));
@@ -196,7 +249,7 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
private void buildInternalBootstrapConfigFiles(List internalConfigFiles, String namespace, String serviceName, List profileList) {
for (String profile : profileList) {
- if (!StringUtils.hasText(profile)) {
+ if (StringUtils.isBlank(profile)) {
continue;
}
internalConfigFiles.add(new DefaultConfigFileMetadata(namespace, serviceName, "bootstrap-" + profile + ".properties"));
@@ -209,7 +262,7 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
internalConfigFiles.add(new DefaultConfigFileMetadata(namespace, serviceName, "bootstrap.yaml"));
}
- private void initTsfConfigGroups(CompositePropertySource compositePropertySource) {
+ void initTsfConfigGroups(CompositePropertySource compositePropertySource) {
String tsfId = environment.getProperty("tsf_id");
String tsfNamespaceName = environment.getProperty("tsf_namespace_name");
String tsfGroupName = environment.getProperty("tsf_group_name");
@@ -219,11 +272,11 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
}
String namespace = polarisContextProperties.getNamespace();
List tsfConfigGroups = new ArrayList<>();
- tsfConfigGroups.add((StringUtils.hasText(tsfId) ? tsfId + "." : "") + tsfGroupName + ".application_config_group");
- tsfConfigGroups.add((StringUtils.hasText(tsfId) ? tsfId + "." : "") + tsfNamespaceName + ".global_config_group");
+ tsfConfigGroups.add((StringUtils.isNotBlank(tsfId) ? tsfId + "." : "") + tsfGroupName + ".application_config_group");
+ tsfConfigGroups.add((StringUtils.isNotBlank(tsfId) ? tsfId + "." : "") + tsfNamespaceName + ".global_config_group");
if (ClassUtils.isClassPresent("org.springframework.cloud.gateway.filter.GlobalFilter")) {
- tsfConfigGroups.add((StringUtils.hasText(tsfId) ? tsfId + "." : "") + tsfGroupName + ".gateway_config_group");
+ tsfConfigGroups.add((StringUtils.isNotBlank(tsfId) ? tsfId + "." : "") + tsfGroupName + ".gateway_config_group");
}
for (String tsfConfigGroup : tsfConfigGroups) {
PolarisPropertySource polarisPropertySource = loadGroupPolarisPropertySource(configFileService, namespace, tsfConfigGroup);
@@ -241,12 +294,12 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
for (ConfigFileGroup configFileGroup : configFileGroups) {
String groupNamespace = configFileGroup.getNamespace();
- if (!StringUtils.hasText(groupNamespace)) {
+ if (StringUtils.isBlank(groupNamespace)) {
groupNamespace = namespace;
}
String group = configFileGroup.getName();
- if (!StringUtils.hasText(group)) {
+ if (StringUtils.isBlank(group)) {
continue;
}
@@ -274,63 +327,4 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
}
}
}
-
- public static PolarisPropertySource loadPolarisPropertySource(ConfigFileService configFileService, String namespace, String group, String fileName) {
- ConfigKVFile configKVFile = loadConfigKVFile(configFileService, namespace, group, fileName);
-
- Map map = new ConcurrentHashMap<>();
- for (String key : configKVFile.getPropertyNames()) {
- map.put(key, configKVFile.getProperty(key, null));
- }
-
- return new PolarisPropertySource(namespace, group, fileName, configKVFile, map);
- }
-
- public static PolarisPropertySource loadGroupPolarisPropertySource(ConfigFileService configFileService, String namespace, String group) {
- List configKVFiles = new ArrayList<>();
-
- com.tencent.polaris.configuration.api.core.ConfigFileGroup remoteGroup = configFileService.getConfigFileGroup(namespace, group);
- if (remoteGroup == null) {
- return null;
- }
-
- for (ConfigFileMetadata configFile : remoteGroup.getConfigFileMetadataList()) {
- String fileName = configFile.getFileName();
- ConfigKVFile configKVFile = loadConfigKVFile(configFileService, namespace, group, fileName);
- configKVFiles.add(configKVFile);
- }
-
- CompositeConfigFile compositeConfigFile = new CompositeConfigFile(configKVFiles);
-
- Map map = new ConcurrentHashMap<>();
- for (String key : compositeConfigFile.getPropertyNames()) {
- String value = compositeConfigFile.getProperty(key, null);
- map.put(key, value);
- }
-
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("namespace='" + namespace + '\''
- + ", group='" + group + '\'' + ", fileName='" + compositeConfigFile + '\''
- + ", map='" + map + '\'');
- }
-
- return new PolarisPropertySource(namespace, group, "", compositeConfigFile, map);
- }
-
- public static ConfigKVFile loadConfigKVFile(ConfigFileService configFileService, String namespace, String group, String fileName) {
- ConfigKVFile configKVFile;
- // unknown extension is resolved as properties file
- if (ConfigFileFormat.isPropertyFile(fileName) || ConfigFileFormat.isUnknownFile(fileName)) {
- configKVFile = configFileService.getConfigPropertiesFile(namespace, group, fileName);
- }
- else if (ConfigFileFormat.isYamlFile(fileName)) {
- configKVFile = configFileService.getConfigYamlFile(namespace, group, fileName);
- }
- else {
- LOGGER.warn("[SCT Config] Unsupported config file. namespace = {}, group = {}, fileName = {}", namespace, group, fileName);
-
- throw new IllegalStateException("Only configuration files in the format of properties / yaml / yaml" + " can be injected into the spring context");
- }
- return configKVFile;
- }
}
diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigPropertyAutoRefresher.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigPropertyAutoRefresher.java
index cdd31b7c3..c30f13d9c 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigPropertyAutoRefresher.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigPropertyAutoRefresher.java
@@ -26,7 +26,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
-import com.google.common.collect.Sets;
import com.tencent.cloud.polaris.config.config.PolarisConfigProperties;
import com.tencent.cloud.polaris.config.logger.PolarisConfigLoggerContext;
import com.tencent.cloud.polaris.config.utils.PolarisPropertySourceUtils;
@@ -39,6 +38,7 @@ import com.tencent.polaris.configuration.api.core.ConfigPropertyChangeInfo;
import com.tencent.polaris.configuration.client.internal.CompositeConfigFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import shade.polaris.com.google.common.collect.Sets;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
@@ -55,16 +55,11 @@ import org.springframework.util.CollectionUtils;
public abstract class PolarisConfigPropertyAutoRefresher implements ApplicationListener, PolarisConfigPropertyRefresher {
private static final Logger LOGGER = LoggerFactory.getLogger(PolarisConfigPropertyAutoRefresher.class);
-
+ private static final Set registeredPolarisPropertySets = Sets.newConcurrentHashSet();
private final PolarisConfigProperties polarisConfigProperties;
-
private final AtomicBoolean registered = new AtomicBoolean(false);
-
// this class provides customized logic for some customers to configure special business group files
private final PolarisConfigCustomExtensionLayer polarisConfigCustomExtensionLayer = PolarisServiceLoaderUtil.getPolarisConfigCustomExtensionLayer();
-
- private static final Set registeredPolarisPropertySets = Sets.newConcurrentHashSet();
-
private final ConfigFileService configFileService;
public PolarisConfigPropertyAutoRefresher(PolarisConfigProperties polarisConfigProperties,
diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/annotation/PolarisConfigAnnotationProcessor.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/annotation/PolarisConfigAnnotationProcessor.java
index 16c3d42bf..8a1fbb117 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/annotation/PolarisConfigAnnotationProcessor.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/annotation/PolarisConfigAnnotationProcessor.java
@@ -18,15 +18,16 @@
package com.tencent.cloud.polaris.config.annotation;
import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
import com.tencent.cloud.polaris.config.listener.ConfigChangeEvent;
import com.tencent.cloud.polaris.config.listener.ConfigChangeListener;
import com.tencent.cloud.polaris.config.listener.SyncConfigChangeListener;
+import shade.polaris.com.google.common.base.Preconditions;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
@@ -104,11 +105,14 @@ public class PolarisConfigAnnotationProcessor implements BeanPostProcessor, Prio
}
};
- Set interestedKeys =
- annotatedInterestedKeys.length > 0 ? Sets.newHashSet(annotatedInterestedKeys) : null;
- Set interestedKeyPrefixes =
- annotatedInterestedKeyPrefixes.length > 0 ? Sets.newHashSet(annotatedInterestedKeyPrefixes)
- : null;
+ Set interestedKeys = new HashSet<>();
+ if (annotatedInterestedKeys.length > 0) {
+ Collections.addAll(interestedKeys, annotatedInterestedKeys);
+ }
+ Set interestedKeyPrefixes = new HashSet<>();
+ if (annotatedInterestedKeyPrefixes.length > 0) {
+ Collections.addAll(interestedKeyPrefixes, annotatedInterestedKeyPrefixes);
+ }
addChangeListener(configChangeListener, interestedKeys, interestedKeyPrefixes);
}
diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigChangeEventListener.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigChangeEventListener.java
index 9da4bbe6f..b1c2dd350 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigChangeEventListener.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigChangeEventListener.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
-import com.google.common.collect.Maps;
import com.tencent.cloud.polaris.config.spring.event.ConfigChangeSpringEvent;
import com.tencent.polaris.configuration.api.core.ConfigPropertyChangeInfo;
import org.slf4j.Logger;
@@ -96,7 +95,7 @@ public final class PolarisConfigChangeEventListener implements ApplicationListen
*/
@SuppressWarnings("unchecked")
private Map loadEnvironmentProperties(ConfigurableEnvironment environment) {
- Map ret = Maps.newHashMap();
+ Map ret = new HashMap<>();
MutablePropertySources sources = environment.getPropertySources();
sources.iterator().forEachRemaining(propertySource -> {
// Don't read system env variable.
diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigListenerContext.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigListenerContext.java
index 6f66712b8..519ca7a0e 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigListenerContext.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/listener/PolarisConfigListenerContext.java
@@ -17,26 +17,28 @@
package com.tencent.cloud.polaris.config.listener;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import com.tencent.polaris.api.utils.CollectionUtils;
import com.tencent.polaris.configuration.api.core.ConfigKVFileChangeListener;
import com.tencent.polaris.configuration.api.core.ConfigPropertyChangeInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import shade.polaris.com.google.common.cache.Cache;
+import shade.polaris.com.google.common.cache.CacheBuilder;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
@@ -65,15 +67,15 @@ public final class PolarisConfigListenerContext {
/**
* All custom {@link ConfigChangeListener} instance defined in application .
*/
- private static final List listeners = Lists.newCopyOnWriteArrayList();
+ private static final List listeners = new CopyOnWriteArrayList<>();
/**
* All custom interested keys defined in application .
*/
- private static final Map> interestedKeys = Maps.newConcurrentMap();
+ private static final Map> interestedKeys = new ConcurrentHashMap<>();
/**
* All custom interested key prefixes defined in application .
*/
- private static final Map> interestedKeyPrefixes = Maps.newConcurrentMap();
+ private static final Map> interestedKeyPrefixes = new ConcurrentHashMap<>();
/**
* Cache all latest configuration information for users in the application environment .
*/
@@ -129,11 +131,11 @@ public final class PolarisConfigListenerContext {
* @return merged properties result map
*/
static Map merge(Map ret) {
- Map changes = Maps.newHashMap();
+ Map changes = new HashMap<>();
if (!ret.isEmpty()) {
- Map origin = Maps.newHashMap(properties.asMap());
- Map deleted = Maps.newHashMap();
+ Map origin = new HashMap<>(properties.asMap());
+ Map deleted = new HashMap<>();
origin.keySet().parallelStream().forEach(key -> {
if (!ret.containsKey(key)) {
@@ -175,8 +177,8 @@ public final class PolarisConfigListenerContext {
@Nullable Set interestedKeys, @Nullable Set interestedKeyPrefixes) {
if (!listeners.contains(listener)) {
listeners.add(listener);
- PolarisConfigListenerContext.interestedKeys.put(listener, interestedKeys == null ? Sets.newHashSet() : interestedKeys);
- PolarisConfigListenerContext.interestedKeyPrefixes.put(listener, interestedKeyPrefixes == null ? Sets.newHashSet() : interestedKeyPrefixes);
+ PolarisConfigListenerContext.interestedKeys.put(listener, CollectionUtils.isEmpty(interestedKeys) ? new HashSet<>() : interestedKeys);
+ PolarisConfigListenerContext.interestedKeyPrefixes.put(listener, CollectionUtils.isEmpty(interestedKeyPrefixes) ? new HashSet<>() : interestedKeyPrefixes);
}
}
@@ -211,7 +213,7 @@ public final class PolarisConfigListenerContext {
* @return list of matched {@link ConfigChangeListener}
*/
private static List findMatchedConfigChangeListeners(Set changedKeys) {
- final List configChangeListeners = Lists.newArrayList();
+ final List configChangeListeners = new ArrayList<>();
for (ConfigChangeListener listener : listeners) {
if (isConfigChangeListenerInterested(listener, changedKeys)) {
configChangeListeners.add(listener);
@@ -262,7 +264,7 @@ public final class PolarisConfigListenerContext {
* @return set of all interested keys in listener
*/
private static Set resolveInterestedChangedKeys(ConfigChangeListener listener, Set changedKeys) {
- Set interestedChangedKeys = Sets.newHashSet();
+ Set interestedChangedKeys = new HashSet<>();
if (interestedKeys.containsKey(listener)) {
Set interestedKeys = PolarisConfigListenerContext.interestedKeys.get(listener);
diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/annotation/SpringValueProcessor.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/annotation/SpringValueProcessor.java
index 19e4a0f56..200ac9f73 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/annotation/SpringValueProcessor.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/annotation/SpringValueProcessor.java
@@ -26,12 +26,8 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
-import com.google.common.base.CaseFormat;
-import com.google.common.collect.LinkedListMultimap;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
import com.tencent.cloud.polaris.config.config.PolarisConfigProperties;
import com.tencent.cloud.polaris.config.spring.property.PlaceholderHelper;
import com.tencent.cloud.polaris.config.spring.property.SpringValue;
@@ -40,6 +36,10 @@ import com.tencent.cloud.polaris.config.spring.property.SpringValueRegistry;
import com.tencent.polaris.api.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import shade.polaris.com.google.common.base.CaseFormat;
+import shade.polaris.com.google.common.collect.LinkedListMultimap;
+import shade.polaris.com.google.common.collect.Multimap;
+import shade.polaris.com.google.common.collect.Sets;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;
@@ -73,7 +73,7 @@ public class SpringValueProcessor extends PolarisProcessor implements BeanDefini
private static final Set PROPERTY_VALUES_PROCESSED_BEAN_FACTORIES = Sets.newConcurrentHashSet();
private static final Map> BEAN_DEFINITION_REGISTRY_MULTIMAP_CONCURRENT_MAP =
- Maps.newConcurrentMap();
+ new ConcurrentHashMap<>();
private final PolarisConfigProperties polarisConfigProperties;
private final PlaceholderHelper placeholderHelper;
private final SpringValueRegistry springValueRegistry;
@@ -90,6 +90,33 @@ public class SpringValueProcessor extends PolarisProcessor implements BeanDefini
beanName2SpringValueDefinitions = LinkedListMultimap.create();
}
+ /**
+ * whether the class is primitive or wrapper.
+ * @param clazz the class under analysis.
+ * @return true if the class is primitive or wrapper, otherwise false.
+ */
+ private static boolean isPrimitiveOrWrapper(Class> clazz) {
+ return clazz.isPrimitive() ||
+ clazz == String.class ||
+ clazz == Boolean.class ||
+ clazz == Character.class ||
+ clazz == Byte.class ||
+ clazz == Short.class ||
+ clazz == Integer.class ||
+ clazz == Long.class ||
+ clazz == Float.class ||
+ clazz == Double.class;
+ }
+
+ /**
+ * whether the class is collection(array, collection, map).
+ * @param clazz the class under analysis.
+ * @return true if the class is collection(array, collection, map), otherwise false.
+ */
+ private static boolean isCollection(Class> clazz) {
+ return clazz.isArray() || Collection.class.isAssignableFrom(clazz) || Map.class.isAssignableFrom(clazz);
+ }
+
@Override
public void postProcessBeanFactory(@NonNull ConfigurableListableBeanFactory beanFactory)
throws BeansException {
@@ -108,7 +135,6 @@ public class SpringValueProcessor extends PolarisProcessor implements BeanDefini
return bean;
}
-
@Override
protected void processClass(Object bean, String beanName, Class> clazz, boolean isRefreshScope) {
ConfigurationProperties configurationProperties = clazz.getAnnotation(ConfigurationProperties.class);
@@ -178,7 +204,8 @@ public class SpringValueProcessor extends PolarisProcessor implements BeanDefini
springValueRegistry.putRefreshScopeKeys(keys);
}
// method parameter class with @ConfigurationProperties
- ConfigurationProperties configurationProperties = parameter.getType().getAnnotation(ConfigurationProperties.class);
+ ConfigurationProperties configurationProperties = parameter.getType()
+ .getAnnotation(ConfigurationProperties.class);
parseConfigurationPropertiesKeys(configurationProperties, parameter.getType());
}
@@ -192,7 +219,8 @@ public class SpringValueProcessor extends PolarisProcessor implements BeanDefini
continue;
}
// field class with @ConfigurationProperties
- ConfigurationProperties configurationProperties = field.getType().getAnnotation(ConfigurationProperties.class);
+ ConfigurationProperties configurationProperties = field.getType()
+ .getAnnotation(ConfigurationProperties.class);
parseConfigurationPropertiesKeys(configurationProperties, field.getType());
}
}
@@ -250,33 +278,6 @@ public class SpringValueProcessor extends PolarisProcessor implements BeanDefini
}
}
- /**
- * whether the class is primitive or wrapper.
- * @param clazz the class under analysis.
- * @return true if the class is primitive or wrapper, otherwise false.
- */
- private static boolean isPrimitiveOrWrapper(Class> clazz) {
- return clazz.isPrimitive() ||
- clazz == String.class ||
- clazz == Boolean.class ||
- clazz == Character.class ||
- clazz == Byte.class ||
- clazz == Short.class ||
- clazz == Integer.class ||
- clazz == Long.class ||
- clazz == Float.class ||
- clazz == Double.class;
- }
-
- /**
- * whether the class is collection(array, collection, map).
- * @param clazz the class under analysis.
- * @return true if the class is collection(array, collection, map), otherwise false.
- */
- private static boolean isCollection(Class> clazz) {
- return clazz.isArray() || Collection.class.isAssignableFrom(clazz) || Map.class.isAssignableFrom(clazz);
- }
-
@Override
public void setBeanFactory(@NonNull BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/PlaceholderHelper.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/PlaceholderHelper.java
index 77ed0629f..6da5797ba 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/PlaceholderHelper.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/PlaceholderHelper.java
@@ -17,17 +17,16 @@
package com.tencent.cloud.polaris.config.spring.property;
+import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
-import com.google.common.base.Strings;
-import com.google.common.collect.Sets;
+import com.tencent.polaris.api.utils.StringUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanExpressionContext;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.config.Scope;
-import org.springframework.util.StringUtils;
/**
* Placeholder helper functions.
@@ -89,7 +88,7 @@ public class PlaceholderHelper {
*
*/
public Set extractPlaceholderKeys(String propertyString) {
- Set placeholderKeys = Sets.newHashSet();
+ Set placeholderKeys = new HashSet<>();
if (!isPlaceholder(propertyString)) {
return placeholderKeys;
@@ -128,7 +127,7 @@ public class PlaceholderHelper {
stack.push(placeholderCandidate.substring(0, separatorIndex));
String defaultValuePart =
normalizeToPlaceholder(placeholderCandidate.substring(separatorIndex + VALUE_SEPARATOR.length()));
- if (!Strings.isNullOrEmpty(defaultValuePart)) {
+ if (StringUtils.isNotBlank(defaultValuePart)) {
stack.push(defaultValuePart);
}
}
@@ -137,7 +136,7 @@ public class PlaceholderHelper {
// has remaining part, e.g. ${a}.${b}
if (endIndex + PLACEHOLDER_SUFFIX.length() < strVal.length() - 1) {
String remainingPart = normalizeToPlaceholder(strVal.substring(endIndex + PLACEHOLDER_SUFFIX.length()));
- if (!Strings.isNullOrEmpty(remainingPart)) {
+ if (StringUtils.isNotBlank(remainingPart)) {
stack.push(remainingPart);
}
}
@@ -147,7 +146,7 @@ public class PlaceholderHelper {
}
private boolean isPlaceholder(String propertyString) {
- return !Strings.isNullOrEmpty(propertyString) &&
+ return StringUtils.isNotBlank(propertyString) &&
(isNormalizedPlaceholder(propertyString) || isExpressionWithPlaceholder(propertyString));
}
diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValueRegistry.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValueRegistry.java
index 3ac250960..a2f501d82 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValueRegistry.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValueRegistry.java
@@ -21,21 +21,21 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import com.google.common.collect.LinkedListMultimap;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Multimaps;
-import com.google.common.collect.Sets;
import com.tencent.polaris.api.pojo.TrieNode;
import com.tencent.polaris.api.utils.TrieUtil;
import com.tencent.polaris.client.util.NamedThreadFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import shade.polaris.com.google.common.collect.LinkedListMultimap;
+import shade.polaris.com.google.common.collect.Multimap;
+import shade.polaris.com.google.common.collect.Multimaps;
+import shade.polaris.com.google.common.collect.Sets;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.DisposableBean;
@@ -53,14 +53,12 @@ public class SpringValueRegistry implements DisposableBean {
private static final Logger logger = LoggerFactory.getLogger(SpringValueRegistry.class);
private static final long CLEAN_INTERVAL_IN_SECONDS = 5;
- private final Map> registry = Maps.newConcurrentMap();
+ private final Map> registry = new ConcurrentHashMap<>();
private final AtomicBoolean initialized = new AtomicBoolean(false);
private final Object LOCK = new Object();
- private ScheduledExecutorService executor;
-
private final TrieNode refreshScopePrefixRoot = new TrieNode<>(TrieNode.ROOT_PATH);
-
private final Set refreshScopeKeys = Sets.newConcurrentHashSet();
+ private ScheduledExecutorService executor;
public void register(BeanFactory beanFactory, String key, SpringValue springValue) {
if (!registry.containsKey(beanFactory)) {
diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/tsf/PolarisAdaptorTsfConfigAutoConfiguration.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/tsf/PolarisAdaptorTsfConfigAutoConfiguration.java
index f7afcb521..589305f7c 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/tsf/PolarisAdaptorTsfConfigAutoConfiguration.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/tsf/PolarisAdaptorTsfConfigAutoConfiguration.java
@@ -24,6 +24,7 @@ import com.tencent.tsf.consul.config.watch.TsfConsulConfigRefreshEventListener;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -52,6 +53,7 @@ public class PolarisAdaptorTsfConfigAutoConfiguration {
*/
@Bean
@ConditionalOnMissingBean
+ @ConditionalOnWebApplication
@ConditionalOnProperty(name = "tsf.config.instance.released-config.lookup.enabled", matchIfMissing = true)
public PolarisAdaptorTsfConfigController polarisAdaptorTsfConfigController() {
return new PolarisAdaptorTsfConfigController();
diff --git a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocatorTest.java b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocatorTest.java
index 91c6dc888..3bb1cc392 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocatorTest.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFileLocatorTest.java
@@ -18,13 +18,13 @@
package com.tencent.cloud.polaris.config.adapter;
import java.lang.reflect.Field;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import com.google.common.collect.Lists;
import com.tencent.cloud.polaris.config.config.ConfigFileGroup;
import com.tencent.cloud.polaris.config.config.PolarisConfigProperties;
import com.tencent.cloud.polaris.context.config.PolarisContextProperties;
@@ -179,7 +179,10 @@ public class PolarisConfigFileLocatorTest {
configFileGroup.setName(customGroup);
String customFile1 = "file1.properties";
String customFile2 = "file2.properties";
- configFileGroup.setFiles(Lists.newArrayList(customFile1, customFile2));
+ List files = new ArrayList<>();
+ files.add(customFile1);
+ files.add(customFile2);
+ configFileGroup.setFiles(files);
customFiles.add(configFileGroup);
when(polarisConfigProperties.isEnabled()).thenReturn(true);
diff --git a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/endpoint/PolarisConfigEndpointTest.java b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/endpoint/PolarisConfigEndpointTest.java
index a5abe85e7..45d62a4f4 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/endpoint/PolarisConfigEndpointTest.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/endpoint/PolarisConfigEndpointTest.java
@@ -17,10 +17,10 @@
package com.tencent.cloud.polaris.config.endpoint;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import com.google.common.collect.Lists;
import com.tencent.cloud.polaris.config.adapter.MockedConfigKVFile;
import com.tencent.cloud.polaris.config.adapter.PolarisPropertySource;
import com.tencent.cloud.polaris.config.adapter.PolarisPropertySourceManager;
@@ -67,6 +67,6 @@ public class PolarisConfigEndpointTest {
PolarisConfigEndpoint endpoint = new PolarisConfigEndpoint(polarisConfigProperties);
Map info = endpoint.polarisConfig();
assertThat(polarisConfigProperties).isEqualTo(info.get("PolarisConfigProperties"));
- assertThat(Lists.newArrayList(polarisPropertySource)).isEqualTo(info.get("PolarisPropertySource"));
+ assertThat(Collections.singletonList(polarisPropertySource)).isEqualTo(info.get("PolarisPropertySource"));
}
}
diff --git a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/listener/ConfigChangeListenerTest.java b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/listener/ConfigChangeListenerTest.java
index 8a486d6e5..78720df99 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/listener/ConfigChangeListenerTest.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/listener/ConfigChangeListenerTest.java
@@ -18,10 +18,11 @@
package com.tencent.cloud.polaris.config.listener;
import java.lang.reflect.Field;
+import java.util.HashSet;
+import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import com.google.common.collect.Sets;
import com.tencent.cloud.polaris.config.adapter.PolarisConfigFileLocator;
import com.tencent.cloud.polaris.config.annotation.PolarisConfigKVFileChangeListener;
import com.tencent.polaris.configuration.api.core.ConfigPropertyChangeInfo;
@@ -83,8 +84,9 @@ public class ConfigChangeListenerTest {
//submit change event
System.setProperty("timeout", "2000");
- EnvironmentChangeEvent event = new EnvironmentChangeEvent(applicationContext,
- Sets.newHashSet("timeout"));
+ Set ketSet = new HashSet<>();
+ ketSet.add("timeout");
+ EnvironmentChangeEvent event = new EnvironmentChangeEvent(applicationContext, ketSet);
applicationEventPublisher.publishEvent(event);
diff --git a/spring-cloud-starter-tencent-polaris-contract/pom.xml b/spring-cloud-starter-tencent-polaris-contract/pom.xml
index 39aca1001..52e320192 100644
--- a/spring-cloud-starter-tencent-polaris-contract/pom.xml
+++ b/spring-cloud-starter-tencent-polaris-contract/pom.xml
@@ -38,17 +38,27 @@
org.springdoc
springdoc-openapi-ui
+
+
+ org.springframework
+ spring-webmvc
+
+
+ org.springframework
+ spring-web
+
+
org.springdoc
springdoc-openapi-webflux-ui
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
+
+
+ org.springframework
+ spring-webflux
+
+
diff --git a/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/PolarisContractReporter.java b/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/PolarisContractReporter.java
index 66e2e01bb..3e2408636 100644
--- a/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/PolarisContractReporter.java
+++ b/spring-cloud-starter-tencent-polaris-contract/src/main/java/com/tencent/cloud/polaris/contract/PolarisContractReporter.java
@@ -33,6 +33,7 @@ import com.tencent.polaris.api.core.ProviderAPI;
import com.tencent.polaris.api.plugin.server.InterfaceDescriptor;
import com.tencent.polaris.api.plugin.server.ReportServiceContractRequest;
import com.tencent.polaris.api.plugin.server.ReportServiceContractResponse;
+import com.tencent.polaris.api.utils.CollectionUtils;
import com.tencent.polaris.api.utils.StringUtils;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
@@ -49,7 +50,6 @@ import org.springdoc.webmvc.api.OpenApiWebMvcUtil;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
-import org.springframework.util.CollectionUtils;
/**
* Polaris contract reporter.
diff --git a/spring-cloud-starter-tencent-polaris-discovery/pom.xml b/spring-cloud-starter-tencent-polaris-discovery/pom.xml
index 55104194e..c2c532ec6 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/pom.xml
+++ b/spring-cloud-starter-tencent-polaris-discovery/pom.xml
@@ -23,12 +23,6 @@
com.tencent.cloud
spring-cloud-tencent-rpc-enhancement
-
-
- spring-security-crypto
- org.springframework.security
-
-
@@ -38,29 +32,11 @@
-
- com.tencent.polaris
- polaris-test-common
- test
-
-
com.tencent.polaris
connector-nacos
test
-
-
- com.tencent.polaris
- polaris-test-mock-discovery
- test
-
-
- junit
- junit
-
-
-
@@ -98,12 +74,6 @@
true
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
org.springframework.boot
spring-boot-actuator
@@ -115,22 +85,5 @@
spring-boot-actuator-autoconfigure
true
-
-
- joda-time
- joda-time
-
-
-
- org.mockito
- mockito-inline
- test
-
-
-
- io.projectreactor
- reactor-test
- test
-
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/PolarisDiscoveryAutoConfiguration.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/PolarisDiscoveryAutoConfiguration.java
index 78129c4bc..038283042 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/PolarisDiscoveryAutoConfiguration.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/PolarisDiscoveryAutoConfiguration.java
@@ -17,16 +17,13 @@
package com.tencent.cloud.polaris.discovery;
-import com.tencent.cloud.polaris.PolarisDiscoveryProperties;
import com.tencent.cloud.polaris.discovery.reactive.PolarisReactiveDiscoveryClientConfiguration;
import com.tencent.cloud.polaris.discovery.refresh.PolarisRefreshConfiguration;
-import com.tencent.cloud.polaris.extend.nacos.NacosContextProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
-import org.springframework.lang.Nullable;
/**
* Discovery Auto Configuration for Polaris.
@@ -41,13 +38,7 @@ public class PolarisDiscoveryAutoConfiguration {
@Bean
@ConditionalOnMissingBean
- public PolarisServiceDiscovery polarisServiceDiscovery(
- @Nullable NacosContextProperties nacosContextProperties,
- PolarisDiscoveryProperties polarisDiscoveryProperties,
- PolarisDiscoveryHandler polarisDiscoveryHandler) {
- return new PolarisServiceDiscovery(
- nacosContextProperties,
- polarisDiscoveryProperties,
- polarisDiscoveryHandler);
+ public PolarisServiceDiscovery polarisServiceDiscovery(PolarisDiscoveryHandler polarisDiscoveryHandler) {
+ return new PolarisServiceDiscovery(polarisDiscoveryHandler);
}
}
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/PolarisServiceDiscovery.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/PolarisServiceDiscovery.java
index a99f99fb6..bb97791ca 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/PolarisServiceDiscovery.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/PolarisServiceDiscovery.java
@@ -24,8 +24,6 @@ import java.util.stream.Collectors;
import com.tencent.cloud.common.pojo.PolarisServiceInstance;
import com.tencent.cloud.common.util.DiscoveryUtil;
-import com.tencent.cloud.polaris.PolarisDiscoveryProperties;
-import com.tencent.cloud.polaris.extend.nacos.NacosContextProperties;
import com.tencent.polaris.api.exception.PolarisException;
import com.tencent.polaris.api.pojo.Instance;
import com.tencent.polaris.api.pojo.ServiceInfo;
@@ -42,18 +40,9 @@ import org.springframework.util.CollectionUtils;
*/
public class PolarisServiceDiscovery {
- private final NacosContextProperties nacosContextProperties;
-
- private final PolarisDiscoveryProperties polarisDiscoveryProperties;
-
private final PolarisDiscoveryHandler polarisDiscoveryHandler;
- public PolarisServiceDiscovery(
- NacosContextProperties nacosContextProperties,
- PolarisDiscoveryProperties polarisDiscoveryProperties,
- PolarisDiscoveryHandler polarisDiscoveryHandler) {
- this.nacosContextProperties = nacosContextProperties;
- this.polarisDiscoveryProperties = polarisDiscoveryProperties;
+ public PolarisServiceDiscovery(PolarisDiscoveryHandler polarisDiscoveryHandler) {
this.polarisDiscoveryHandler = polarisDiscoveryHandler;
}
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/refresh/PolarisServiceStatusChangeListener.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/refresh/PolarisServiceStatusChangeListener.java
index bf4a829db..e1fc9529b 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/refresh/PolarisServiceStatusChangeListener.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/discovery/refresh/PolarisServiceStatusChangeListener.java
@@ -23,7 +23,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
-import com.google.common.collect.Sets;
import com.tencent.polaris.api.plugin.registry.AbstractResourceEventListener;
import com.tencent.polaris.api.pojo.Instance;
import com.tencent.polaris.api.pojo.RegistryCacheValue;
@@ -33,6 +32,7 @@ import com.tencent.polaris.client.pojo.ServiceInstancesByProto;
import com.tencent.polaris.client.pojo.ServicesByProto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import shade.polaris.com.google.common.collect.Sets;
import org.springframework.cloud.client.discovery.event.HeartbeatEvent;
import org.springframework.context.ApplicationEventPublisher;
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/endpoint/PolarisDiscoveryEndpoint.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/endpoint/PolarisDiscoveryEndpoint.java
index 8d260ed5d..a5058161f 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/endpoint/PolarisDiscoveryEndpoint.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/endpoint/PolarisDiscoveryEndpoint.java
@@ -26,7 +26,7 @@ import com.tencent.cloud.polaris.PolarisDiscoveryProperties;
import com.tencent.cloud.polaris.discovery.PolarisDiscoveryHandler;
import com.tencent.polaris.api.pojo.ServiceInstances;
import com.tencent.polaris.api.rpc.InstancesResponse;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulDiscoveryConfigModifier.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulDiscoveryConfigModifier.java
index 5dcfb32b0..a912db65b 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulDiscoveryConfigModifier.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulDiscoveryConfigModifier.java
@@ -145,8 +145,8 @@ public class ConsulDiscoveryConfigModifier implements PolarisConfigModifier {
configuration.getProvider().getRegisters().add(registerConfig);
// heartbeat
- polarisDiscoveryProperties.setHeartbeatInterval(Long.valueOf(
- consulHeartbeatProperties.computeHeartbeatInterval().toStandardDuration().getMillis()).intValue());
+ polarisDiscoveryProperties.setHeartbeatInterval(
+ (int) consulHeartbeatProperties.computeHeartbeatInterval().getSeconds());
}
@Override
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulDiscoveryUtil.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulDiscoveryUtil.java
index dd3f187bc..a1dcb2c7d 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulDiscoveryUtil.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulDiscoveryUtil.java
@@ -116,7 +116,7 @@ public final class ConsulDiscoveryUtil {
Assert.notNull(checkPort, "checkPort may not be null");
for (ServerConnectorConfigImpl config : configuration.getGlobal().getServerConnectors()) {
- if (org.apache.commons.lang.StringUtils.equals(config.getId(), ID)) {
+ if (StringUtils.equals(config.getId(), ID)) {
Map metadata = config.getMetadata();
NewService.Check check = createCheck(checkPort, consulHeartbeatProperties, properties, tsfCoreProperties);
String checkJson = JacksonUtils.serialize2Json(check);
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulHeartbeatProperties.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulHeartbeatProperties.java
index 23df9aadf..6e35a2583 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulHeartbeatProperties.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/consul/ConsulHeartbeatProperties.java
@@ -17,18 +17,14 @@
package com.tencent.cloud.polaris.extend.consul;
-import javax.validation.constraints.DecimalMax;
-import javax.validation.constraints.DecimalMin;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
+import java.time.Duration;
-import org.joda.time.Period;
+import com.tencent.polaris.api.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.style.ToStringCreator;
-import org.springframework.validation.annotation.Validated;
/**
* Copy from org.springframework.cloud.consul.discovery.HeartbeatProperties.
@@ -38,7 +34,6 @@ import org.springframework.validation.annotation.Validated;
* @author Chris Bono
*/
@ConfigurationProperties(prefix = "spring.cloud.consul.discovery.heartbeat")
-@Validated
public class ConsulHeartbeatProperties {
private static final Logger LOGGER = LoggerFactory.getLogger(ConsulHeartbeatProperties.class);
@@ -46,26 +41,22 @@ public class ConsulHeartbeatProperties {
// [WARN] agent: Check 'service:testConsulApp:xtest:8080' missed TTL, is now critical
boolean enabled = true;
- @Min(1)
private int ttlValue = 30;
- @NotNull
private String ttlUnit = "s";
- @DecimalMin("0.1")
- @DecimalMax("0.9")
private double intervalRatio = 2.0 / 3.0;
//TODO: did heartbeatInterval need to be a field?
- protected Period computeHeartbeatInterval() {
+ protected Duration computeHeartbeatInterval() {
// heartbeat rate at ratio * ttl, but no later than ttl -1s and, (under lesser
// priority), no sooner than 1s from now
double interval = ttlValue * intervalRatio;
double max = Math.max(interval, 1);
int ttlMinus1 = ttlValue - 1;
double min = Math.min(ttlMinus1, max);
- Period heartbeatInterval = new Period(Math.round(1000 * min));
+ Duration heartbeatInterval = Duration.ofMillis(Math.round(1000 * min));
LOGGER.debug("Computed heartbeatInterval: " + heartbeatInterval);
return heartbeatInterval;
}
@@ -82,27 +73,39 @@ public class ConsulHeartbeatProperties {
this.enabled = enabled;
}
- public @Min(1) int getTtlValue() {
+ public int getTtlValue() {
return this.ttlValue;
}
- public void setTtlValue(@Min(1) int ttlValue) {
+ public void setTtlValue(int ttlValue) {
+ if (ttlValue < 1) {
+ LOGGER.error("ttlValue must be at least 1, invalid value: {}", ttlValue);
+ throw new IllegalArgumentException("ttlValue must be at least 1");
+ }
this.ttlValue = ttlValue;
}
- public @NotNull String getTtlUnit() {
+ public String getTtlUnit() {
return this.ttlUnit;
}
- public void setTtlUnit(@NotNull String ttlUnit) {
+ public void setTtlUnit(String ttlUnit) {
+ if (StringUtils.isEmpty(ttlUnit)) {
+ LOGGER.error("ttlUnit cannot be null or empty");
+ throw new IllegalArgumentException("ttlUnit cannot be null or empty");
+ }
this.ttlUnit = ttlUnit;
}
- public @DecimalMin("0.1") @DecimalMax("0.9") double getIntervalRatio() {
+ public double getIntervalRatio() {
return this.intervalRatio;
}
- public void setIntervalRatio(@DecimalMin("0.1") @DecimalMax("0.9") double intervalRatio) {
+ public void setIntervalRatio(double intervalRatio) {
+ if (intervalRatio < 0.1 || intervalRatio > 0.9) {
+ LOGGER.error("intervalRatio must be between 0.1 and 0.9, invalid value: {}", intervalRatio);
+ throw new IllegalArgumentException("intervalRatio must be between 0.1 and 0.9");
+ }
this.intervalRatio = intervalRatio;
}
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/nacos/NacosConfigModifier.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/nacos/NacosConfigModifier.java
index 21b226321..a02b00126 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/nacos/NacosConfigModifier.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/extend/nacos/NacosConfigModifier.java
@@ -25,15 +25,15 @@ import java.util.Objects;
import com.tencent.cloud.common.constant.OrderConstant;
import com.tencent.cloud.polaris.context.PolarisConfigModifier;
import com.tencent.polaris.api.config.plugin.DefaultPlugins;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.factory.config.ConfigurationImpl;
import com.tencent.polaris.factory.config.consumer.DiscoveryConfigImpl;
import com.tencent.polaris.factory.config.global.ServerConnectorConfigImpl;
import com.tencent.polaris.factory.config.provider.RegisterConfigImpl;
-import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.util.CollectionUtils;
/**
* {@link PolarisConfigModifier} impl of Nacos.
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisRegistration.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisRegistration.java
index f8b93b9b1..1738f2d69 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisRegistration.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisRegistration.java
@@ -28,15 +28,15 @@ import com.tencent.cloud.polaris.PolarisDiscoveryProperties;
import com.tencent.cloud.polaris.context.config.PolarisContextProperties;
import com.tencent.cloud.polaris.extend.consul.ConsulDiscoveryProperties;
import com.tencent.cloud.polaris.extend.nacos.NacosContextProperties;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.client.api.SDKContext;
-import org.apache.commons.lang.StringUtils;
import org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext;
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.serviceregistry.Registration;
import org.springframework.lang.Nullable;
-import org.springframework.util.CollectionUtils;
import static com.tencent.cloud.polaris.extend.nacos.NacosContextProperties.DEFAULT_CLUSTER;
import static com.tencent.cloud.polaris.extend.nacos.NacosContextProperties.DEFAULT_GROUP;
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisServiceRegistry.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisServiceRegistry.java
index 71de4be33..c6816a0f5 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisServiceRegistry.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisServiceRegistry.java
@@ -43,12 +43,12 @@ import com.tencent.polaris.api.rpc.InstanceHeartbeatRequest;
import com.tencent.polaris.api.rpc.InstanceRegisterRequest;
import com.tencent.polaris.api.rpc.InstanceRegisterResponse;
import com.tencent.polaris.api.rpc.InstancesResponse;
+import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.client.util.NamedThreadFactory;
import com.tencent.polaris.factory.config.provider.ServiceConfigImpl;
import com.tencent.polaris.metadata.core.TransitiveType;
import com.tencent.polaris.metadata.core.constant.MetadataConstants;
import com.tencent.polaris.metadata.core.manager.CalleeMetadataContainerGroup;
-import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/tsf/TsfServletRegistrationCustomizer.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/tsf/TsfServletRegistrationCustomizer.java
index 7296e52c5..5651d7db8 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/tsf/TsfServletRegistrationCustomizer.java
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/tsf/TsfServletRegistrationCustomizer.java
@@ -17,17 +17,13 @@
package com.tencent.cloud.polaris.registry.tsf;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletContext;
-import com.tencent.cloud.common.util.JacksonUtils;
import com.tencent.cloud.polaris.registry.PolarisRegistration;
import com.tencent.cloud.polaris.registry.PolarisRegistrationCustomizer;
-import com.tencent.polaris.plugins.connector.common.constant.ConsulConstant;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.util.StringUtils;
@@ -53,14 +49,11 @@ public class TsfServletRegistrationCustomizer implements PolarisRegistrationCust
if (sc != null
&& StringUtils.hasText(sc.getContextPath())
&& StringUtils.hasText(sc.getContextPath().replaceAll("/", ""))) {
- Map metadata = registration.getMetadata();
+ Map metadata = registration.getExtendedMetadata()
+ .computeIfAbsent(TAGS_KEY, k -> new HashMap<>());
- List tags = Arrays.asList(JacksonUtils.deserialize(metadata.get(TAGS_KEY), String[].class));
- if (tags == null) {
- tags = new ArrayList<>();
- }
- tags.add("contextPath=" + sc.getContextPath());
- metadata.put(ConsulConstant.MetadataMapKey.TAGS_KEY, JacksonUtils.serialize2Json(tags));
+ String value = "contextPath=" + sc.getContextPath();
+ metadata.put(value, value);
}
}
}
diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/extend/consul/ConsulHeartbeatPropertiesTest.java b/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/extend/consul/ConsulHeartbeatPropertiesTest.java
new file mode 100644
index 000000000..4290552b9
--- /dev/null
+++ b/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/extend/consul/ConsulHeartbeatPropertiesTest.java
@@ -0,0 +1,108 @@
+/*
+ * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
+ *
+ * Copyright (C) 2021 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 com.tencent.cloud.polaris.extend.consul;
+
+import com.tencent.cloud.common.util.inet.PolarisInetUtilsAutoConfiguration;
+import com.tencent.cloud.polaris.DiscoveryPropertiesAutoConfiguration;
+import com.tencent.cloud.polaris.context.config.PolarisContextAutoConfiguration;
+import org.junit.jupiter.api.Test;
+
+import org.springframework.boot.autoconfigure.AutoConfigurations;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Test for {@link ConsulHeartbeatProperties}.
+ *
+ * @author Haotian Zhang
+ */
+public class ConsulHeartbeatPropertiesTest {
+
+ @Test
+ public void testGettersAndSetters() {
+ ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
+ .withConfiguration(AutoConfigurations.of(PolarisContextAutoConfiguration.class,
+ PolarisInetUtilsAutoConfiguration.class, DiscoveryPropertiesAutoConfiguration.class))
+ .withPropertyValues("spring.cloud.consul.enabled=true")
+ .withPropertyValues("spring.cloud.consul.discovery.heartbeat.ttlValue=60")
+ .withPropertyValues("spring.cloud.consul.discovery.heartbeat.ttl-unit=m")
+ .withPropertyValues("spring.cloud.consul.discovery.heartbeat.interval-ratio=0.5");
+ applicationContextRunner.run(context -> {
+ assertThat(context).hasSingleBean(ConsulHeartbeatProperties.class);
+ ConsulHeartbeatProperties heartbeatProperties = context.getBean(ConsulHeartbeatProperties.class);
+ assertThat(heartbeatProperties.isEnabled()).isTrue();
+ assertThat(heartbeatProperties.getTtlValue()).isEqualTo(60);
+ assertThat(heartbeatProperties.getTtlUnit()).isEqualTo("m");
+ assertThat(heartbeatProperties.getIntervalRatio()).isEqualTo(0.5);
+ });
+ }
+
+ @Test
+ public void testTtlValueWrong() {
+ ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
+ .withConfiguration(AutoConfigurations.of(PolarisInetUtilsAutoConfiguration.class, DiscoveryPropertiesAutoConfiguration.class))
+ .withPropertyValues("spring.cloud.consul.enabled=true")
+ .withPropertyValues("spring.cloud.consul.discovery.heartbeat.ttlValue=0");
+ applicationContextRunner.run(context -> {
+ assertThat(context).hasFailed();
+ assertThat(context.getStartupFailure())
+ .hasRootCauseExactlyInstanceOf(IllegalArgumentException.class)
+ .hasRootCauseMessage("ttlValue must be at least 1");
+ });
+ }
+
+ @Test
+ public void testTtlUnitWrong() {
+ ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
+ .withConfiguration(AutoConfigurations.of(PolarisInetUtilsAutoConfiguration.class, DiscoveryPropertiesAutoConfiguration.class))
+ .withPropertyValues("spring.cloud.consul.enabled=true")
+ .withPropertyValues("spring.cloud.consul.discovery.heartbeat.ttl-unit=");
+ applicationContextRunner.run(context -> {
+ assertThat(context).hasFailed();
+ assertThat(context.getStartupFailure())
+ .hasRootCauseExactlyInstanceOf(IllegalArgumentException.class)
+ .hasRootCauseMessage("ttlUnit cannot be null or empty");
+ });
+ }
+
+ @Test
+ public void testIntervalRatioWrong() {
+ ApplicationContextRunner applicationContextRunner1 = new ApplicationContextRunner()
+ .withConfiguration(AutoConfigurations.of(PolarisInetUtilsAutoConfiguration.class, DiscoveryPropertiesAutoConfiguration.class))
+ .withPropertyValues("spring.cloud.consul.enabled=true")
+ .withPropertyValues("spring.cloud.consul.discovery.heartbeat.interval-ratio=0");
+ applicationContextRunner1.run(context -> {
+ assertThat(context).hasFailed();
+ assertThat(context.getStartupFailure())
+ .hasRootCauseExactlyInstanceOf(IllegalArgumentException.class)
+ .hasRootCauseMessage("intervalRatio must be between 0.1 and 0.9");
+ });
+
+ ApplicationContextRunner applicationContextRunner2 = new ApplicationContextRunner()
+ .withConfiguration(AutoConfigurations.of(PolarisInetUtilsAutoConfiguration.class, DiscoveryPropertiesAutoConfiguration.class))
+ .withPropertyValues("spring.cloud.consul.enabled=true")
+ .withPropertyValues("spring.cloud.consul.discovery.heartbeat.interval-ratio=1");
+ applicationContextRunner2.run(context -> {
+ assertThat(context).hasFailed();
+ assertThat(context.getStartupFailure())
+ .hasRootCauseExactlyInstanceOf(IllegalArgumentException.class)
+ .hasRootCauseMessage("intervalRatio must be between 0.1 and 0.9");
+ });
+ }
+}
diff --git a/spring-cloud-starter-tencent-polaris-ratelimit/pom.xml b/spring-cloud-starter-tencent-polaris-ratelimit/pom.xml
index 642ef9322..4dcec329f 100644
--- a/spring-cloud-starter-tencent-polaris-ratelimit/pom.xml
+++ b/spring-cloud-starter-tencent-polaris-ratelimit/pom.xml
@@ -14,73 +14,12 @@
Spring Cloud Starter Tencent Polaris Ratelimit
-
-
- com.tencent.cloud
- spring-cloud-tencent-rpc-enhancement
-
-
com.tencent.cloud
spring-cloud-starter-tencent-metadata-transfer
-
-
- com.tencent.polaris
- polaris-ratelimit-factory
-
-
- com.tencent.polaris
- router-rule
-
-
- com.tencent.polaris
- router-nearby
-
-
- com.tencent.polaris
- router-namespace
-
-
- com.tencent.polaris
- router-canary
-
-
- com.tencent.polaris
- router-set
-
-
- com.tencent.polaris
- router-isolated
-
-
- com.tencent.polaris
- router-healthy
-
-
-
-
-
- com.tencent.polaris
- polaris-test-common
- test
-
-
-
- com.tencent.polaris
- polaris-test-mock-discovery
- test
-
-
- junit
- junit
-
-
-
-
-
org.springframework.boot
spring-boot-starter-web
@@ -105,34 +44,10 @@
true
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
org.springframework.cloud
spring-cloud-starter-netflix-ribbon
test
-
-
- org.mockito
- mockito-inline
- test
-
-
-
- org.mockito
- mockito-core
- test
-
-
-
- net.bytebuddy
- byte-buddy
- test
-
diff --git a/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/endpoint/PolarisRateLimitRuleEndpoint.java b/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/endpoint/PolarisRateLimitRuleEndpoint.java
index 4c0c904e5..721b5fc36 100644
--- a/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/endpoint/PolarisRateLimitRuleEndpoint.java
+++ b/spring-cloud-starter-tencent-polaris-ratelimit/src/main/java/com/tencent/cloud/polaris/ratelimit/endpoint/PolarisRateLimitRuleEndpoint.java
@@ -22,8 +22,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.util.JsonFormat;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.util.JacksonUtils;
import com.tencent.cloud.polaris.context.ServiceRuleManager;
@@ -31,6 +29,8 @@ import com.tencent.cloud.polaris.ratelimit.config.PolarisRateLimitProperties;
import com.tencent.polaris.specification.api.v1.traffic.manage.RateLimitProto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import shade.polaris.com.google.protobuf.InvalidProtocolBufferException;
+import shade.polaris.com.google.protobuf.util.JsonFormat;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
diff --git a/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/context/CalleeControllerTests.java b/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/context/CalleeControllerTests.java
index 29032c59f..262b9c3e2 100644
--- a/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/context/CalleeControllerTests.java
+++ b/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/context/CalleeControllerTests.java
@@ -17,7 +17,6 @@
package com.tencent.cloud.polaris.context;
-import com.google.protobuf.StringValue;
import com.tencent.cloud.polaris.ratelimit.config.PolarisRateLimitProperties;
import com.tencent.cloud.polaris.ratelimit.filter.QuotaCheckServletFilter;
import com.tencent.cloud.polaris.ratelimit.spi.PolarisRateLimiterLimitedFallback;
@@ -34,6 +33,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import shade.polaris.com.google.protobuf.StringValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
diff --git a/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/endpoint/PolarisRateLimitRuleEndpointTests.java b/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/endpoint/PolarisRateLimitRuleEndpointTests.java
index dded4fc1d..0738a56a2 100644
--- a/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/endpoint/PolarisRateLimitRuleEndpointTests.java
+++ b/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/endpoint/PolarisRateLimitRuleEndpointTests.java
@@ -19,7 +19,6 @@ package com.tencent.cloud.polaris.ratelimit.endpoint;
import java.util.Map;
-import com.google.protobuf.StringValue;
import com.tencent.cloud.polaris.context.ServiceRuleManager;
import com.tencent.cloud.polaris.ratelimit.config.PolarisRateLimitProperties;
import com.tencent.polaris.specification.api.v1.model.ModelProto;
@@ -28,6 +27,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
+import shade.polaris.com.google.protobuf.StringValue;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
diff --git a/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckReactiveFilterTest.java b/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckReactiveFilterTest.java
index 6e9fa39aa..cb2e54cc2 100644
--- a/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckReactiveFilterTest.java
+++ b/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckReactiveFilterTest.java
@@ -22,14 +22,9 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
-import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Collectors;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.StringValue;
-import com.google.protobuf.util.JsonFormat;
-import com.tencent.cloud.common.constant.HeaderConstant;
import com.tencent.cloud.common.constant.OrderConstant;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.polaris.context.ServiceRuleManager;
@@ -47,6 +42,8 @@ import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import reactor.core.publisher.Mono;
+import shade.polaris.com.google.protobuf.InvalidProtocolBufferException;
+import shade.polaris.com.google.protobuf.util.JsonFormat;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
@@ -93,8 +90,7 @@ public class QuotaCheckReactiveFilterTest {
}
else if (serviceName.equals("TestApp3")) {
QuotaResponse response = new QuotaResponse(new QuotaResult(QuotaResult.Code.QuotaResultLimited, 0, "QuotaResultLimited"));
- response.setActiveRule(RateLimitProto.Rule.newBuilder()
- .setName(StringValue.newBuilder().setValue("MOCK_RULE").build()).build());
+ response.setActiveRule(RateLimitProto.Rule.newBuilder().build());
return response;
}
else {
@@ -184,8 +180,6 @@ public class QuotaCheckReactiveFilterTest {
ServerHttpResponse response = testApp3Exchange.getResponse();
assertThat(response.getRawStatusCode()).isEqualTo(419);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE);
- assertThat(response.getHeaders()
- .get(HeaderConstant.INTERNAL_ACTIVE_RULE_NAME)).isEqualTo(Collections.singletonList("MOCK_RULE"));
// Exception
MetadataContext.LOCAL_SERVICE = "TestApp4";
diff --git a/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckServletFilterTest.java b/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckServletFilterTest.java
index 0a42cc310..df6cf00b0 100644
--- a/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckServletFilterTest.java
+++ b/spring-cloud-starter-tencent-polaris-ratelimit/src/test/java/com/tencent/cloud/polaris/ratelimit/filter/QuotaCheckServletFilterTest.java
@@ -28,9 +28,6 @@ import java.util.stream.Collectors;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.StringValue;
-import com.google.protobuf.util.JsonFormat;
import com.tencent.cloud.common.constant.HeaderConstant;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.polaris.context.ServiceRuleManager;
@@ -44,6 +41,9 @@ import com.tencent.polaris.specification.api.v1.traffic.manage.RateLimitProto;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import shade.polaris.com.google.protobuf.InvalidProtocolBufferException;
+import shade.polaris.com.google.protobuf.StringValue;
+import shade.polaris.com.google.protobuf.util.JsonFormat;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
diff --git a/spring-cloud-starter-tencent-polaris-router/pom.xml b/spring-cloud-starter-tencent-polaris-router/pom.xml
index 3975201b4..ce3dbd6ad 100644
--- a/spring-cloud-starter-tencent-polaris-router/pom.xml
+++ b/spring-cloud-starter-tencent-polaris-router/pom.xml
@@ -19,41 +19,13 @@
com.tencent.cloud
spring-cloud-tencent-polaris-loadbalancer
-
- com.tencent.cloud
- spring-cloud-tencent-rpc-enhancement
-
+
com.tencent.cloud
spring-cloud-starter-tencent-metadata-transfer
-
-
- com.tencent.polaris
- router-rule
-
-
- junit
- junit
-
-
-
-
- com.tencent.polaris
- router-metadata
-
-
- com.tencent.polaris
- router-nearby
-
-
- com.tencent.polaris
- router-namespace
-
-
-
org.springframework.cloud
spring-cloud-starter-openfeign
@@ -73,8 +45,8 @@
- org.springframework.retry
- spring-retry
+ org.springframework.boot
+ spring-boot-starter-webflux
true
@@ -97,39 +69,21 @@
- org.springframework.boot
- spring-boot-actuator-autoconfigure
- true
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.mockito
- mockito-inline
- test
-
-
-
- org.mockito
- mockito-core
+ com.squareup.okhttp3
+ okhttp
test
- com.squareup.okhttp3
- okhttp
- test
+ org.springframework.boot
+ spring-boot-actuator-autoconfigure
+ true
- net.bytebuddy
- byte-buddy
- test
+ org.springframework.retry
+ spring-retry
+ true
diff --git a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/PolarisLoadBalancerCompositeRule.java b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/PolarisLoadBalancerCompositeRule.java
index dd7c26ae0..0460f5664 100644
--- a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/PolarisLoadBalancerCompositeRule.java
+++ b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/PolarisLoadBalancerCompositeRule.java
@@ -51,7 +51,7 @@ import com.tencent.polaris.api.pojo.ServiceInstances;
import com.tencent.polaris.router.api.core.RouterAPI;
import com.tencent.polaris.router.api.rpc.ProcessRoutersRequest;
import com.tencent.polaris.router.api.rpc.ProcessRoutersResponse;
-import org.yaml.snakeyaml.util.UriEncoder;
+import shade.polaris.org.yaml.snakeyaml.util.UriEncoder;
import org.springframework.http.HttpRequest;
import org.springframework.util.CollectionUtils;
diff --git a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/PolarisRouterContext.java b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/PolarisRouterContext.java
index 45cbe9f44..2463f9346 100644
--- a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/PolarisRouterContext.java
+++ b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/PolarisRouterContext.java
@@ -23,9 +23,9 @@ import java.util.Map;
import java.util.Set;
import com.tencent.cloud.common.constant.RouterConstant;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
-import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedCaseInsensitiveMap;
/**
diff --git a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/RouterConfigModifier.java b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/RouterConfigModifier.java
index 6ff60d98d..38de4a7a3 100644
--- a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/RouterConfigModifier.java
+++ b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/RouterConfigModifier.java
@@ -21,11 +21,11 @@ import com.tencent.cloud.common.constant.OrderConstant;
import com.tencent.cloud.polaris.context.PolarisConfigModifier;
import com.tencent.cloud.polaris.router.config.properties.PolarisNearByRouterProperties;
import com.tencent.polaris.api.config.consumer.ServiceRouterConfig;
+import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.factory.config.ConfigurationImpl;
import com.tencent.polaris.plugins.router.healthy.RecoverRouterConfig;
import com.tencent.polaris.plugins.router.nearby.NearbyRouterConfig;
import com.tencent.polaris.specification.api.v1.traffic.manage.RoutingProto;
-import org.apache.commons.lang.StringUtils;
/**
* RouterConfigModifier.
diff --git a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/config/RouterAutoConfiguration.java b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/config/RouterAutoConfiguration.java
index 588a8b642..d3328faa0 100644
--- a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/config/RouterAutoConfiguration.java
+++ b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/config/RouterAutoConfiguration.java
@@ -105,7 +105,7 @@ public class RouterAutoConfiguration {
}
@Bean
- @ConditionalOnProperty(value = "spring.cloud.polaris.router.namespace-router.enabled", matchIfMissing = true)
+ @ConditionalOnProperty("spring.cloud.polaris.router.namespace-router.enabled")
public NamespaceRouterRequestInterceptor namespaceRouterRequestInterceptor(PolarisNamespaceRouterProperties polarisNamespaceRouterProperties) {
return new NamespaceRouterRequestInterceptor(polarisNamespaceRouterProperties);
}
diff --git a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/endpoint/PolarisRouterEndpoint.java b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/endpoint/PolarisRouterEndpoint.java
index 27791da0d..4319ad8b6 100644
--- a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/endpoint/PolarisRouterEndpoint.java
+++ b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/endpoint/PolarisRouterEndpoint.java
@@ -22,15 +22,15 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.MessageOrBuilder;
-import com.google.protobuf.util.JsonFormat;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.util.JacksonUtils;
import com.tencent.cloud.polaris.context.ServiceRuleManager;
import com.tencent.polaris.specification.api.v1.traffic.manage.RoutingProto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import shade.polaris.com.google.protobuf.InvalidProtocolBufferException;
+import shade.polaris.com.google.protobuf.MessageOrBuilder;
+import shade.polaris.com.google.protobuf.util.JsonFormat;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
diff --git a/spring-cloud-starter-tencent-polaris-router/src/test/java/com/tencent/cloud/polaris/router/PolarisRouterContextTest.java b/spring-cloud-starter-tencent-polaris-router/src/test/java/com/tencent/cloud/polaris/router/PolarisRouterContextTest.java
index 24db3aca0..e9ef3e011 100644
--- a/spring-cloud-starter-tencent-polaris-router/src/test/java/com/tencent/cloud/polaris/router/PolarisRouterContextTest.java
+++ b/spring-cloud-starter-tencent-polaris-router/src/test/java/com/tencent/cloud/polaris/router/PolarisRouterContextTest.java
@@ -18,9 +18,10 @@
package com.tencent.cloud.polaris.router;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
-import com.google.common.collect.Sets;
import com.tencent.cloud.common.constant.RouterConstant;
import org.junit.jupiter.api.Test;
@@ -74,8 +75,11 @@ public class PolarisRouterContextTest {
PolarisRouterContext routerContext = new PolarisRouterContext();
routerContext.putLabels(RouterConstant.ROUTER_LABELS, labels);
- Map resolvedLabels = routerContext.getLabels(RouterConstant.ROUTER_LABELS,
- Sets.newHashSet("k1", "k2", "k4"));
+ Set labelKeySet = new HashSet<>();
+ labelKeySet.add("k1");
+ labelKeySet.add("k2");
+ labelKeySet.add("k4");
+ Map resolvedLabels = routerContext.getLabels(RouterConstant.ROUTER_LABELS, labelKeySet);
assertThat(resolvedLabels.size()).isEqualTo(2);
assertThat(resolvedLabels.get("k1")).isEqualTo("v1");
diff --git a/spring-cloud-tencent-commons/pom.xml b/spring-cloud-tencent-commons/pom.xml
index fce985dde..853a2ffce 100644
--- a/spring-cloud-tencent-commons/pom.xml
+++ b/spring-cloud-tencent-commons/pom.xml
@@ -22,11 +22,7 @@
com.tencent.polaris
- polaris-model
-
-
- com.tencent.polaris
- polaris-metadata
+ polaris-all
@@ -36,35 +32,29 @@
- org.springframework.boot
- spring-boot-autoconfigure
-
-
-
- org.springframework.boot
- spring-boot-configuration-processor
-
-
-
- org.springframework.boot
- spring-boot-starter-json
+ org.springframework.cloud
+ spring-cloud-context
+
+
+ spring-security-crypto
+ org.springframework.security
+
+
org.springframework.cloud
- spring-cloud-starter
+ spring-cloud-commons
- commons-lang
- commons-lang
- ${commons.lang.version}
+ org.springframework.boot
+ spring-boot-autoconfigure
- commons-io
- commons-io
- ${commons.io.version}
+ org.springframework.boot
+ spring-boot-configuration-processor
@@ -79,11 +69,6 @@
true
-
- com.google.code.gson
- gson
-
-
org.springframework.cloud
spring-cloud-starter-openfeign
@@ -102,35 +87,11 @@
true
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.springframework.boot
- spring-boot-actuator
- true
-
-
org.springframework.boot
spring-boot-actuator-autoconfigure
true
-
-
- com.tencent.polaris
- polaris-test-common
- test
-
-
-
- uk.org.webcompere
- system-stubs-jupiter
- test
-
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/MetadataContextHolder.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/MetadataContextHolder.java
index 55473bfd8..dd5e240ac 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/MetadataContextHolder.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/MetadataContextHolder.java
@@ -23,6 +23,8 @@ import java.util.Map;
import java.util.Optional;
import com.tencent.cloud.common.util.ApplicationContextAwareUtils;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.metadata.core.MessageMetadataContainer;
import com.tencent.polaris.metadata.core.MetadataContainer;
import com.tencent.polaris.metadata.core.MetadataProvider;
@@ -31,9 +33,6 @@ import com.tencent.polaris.metadata.core.TransitiveType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
-
import static com.tencent.cloud.common.metadata.MetadataContext.FRAGMENT_DISPOSABLE;
import static com.tencent.cloud.common.metadata.MetadataContext.FRAGMENT_UPSTREAM_DISPOSABLE;
@@ -88,7 +87,7 @@ public final class MetadataContextHolder {
metadataContainer.putMetadataStringValue(entry.getKey(), entry.getValue(), TransitiveType.DISPOSABLE);
}
// local trans header
- if (StringUtils.hasText(staticMetadataManager.getTransHeader())) {
+ if (StringUtils.isNotBlank(staticMetadataManager.getTransHeader())) {
String transHeader = staticMetadataManager.getTransHeader();
metadataContainer.putMetadataMapValue(MetadataContext.FRAGMENT_RAW_TRANSHEADERS, transHeader, "", TransitiveType.NONE);
}
@@ -159,14 +158,14 @@ public final class MetadataContextHolder {
com.tencent.polaris.metadata.core.manager.MetadataContextHolder.refresh(metadataManager -> {
// caller transitive metadata to local custom transitive metadata
MetadataContainer calleeCustomMetadataContainer = metadataManager.getMetadataContainer(MetadataType.CUSTOM, false);
- if (!CollectionUtils.isEmpty(dynamicTransitiveMetadata)) {
+ if (CollectionUtils.isNotEmpty(dynamicTransitiveMetadata)) {
for (Map.Entry entry : dynamicTransitiveMetadata.entrySet()) {
calleeCustomMetadataContainer.putMetadataStringValue(entry.getKey(), entry.getValue(), TransitiveType.PASS_THROUGH);
}
}
// caller disposable metadata to caller custom disposable metadata
MetadataContainer callerCustomMetadataContainer = metadataManager.getMetadataContainer(MetadataType.CUSTOM, true);
- if (!CollectionUtils.isEmpty(dynamicDisposableMetadata)) {
+ if (CollectionUtils.isNotEmpty(dynamicDisposableMetadata)) {
for (Map.Entry entry : dynamicDisposableMetadata.entrySet()) {
calleeCustomMetadataContainer.putMetadataStringValue(entry.getKey(), entry.getValue(), TransitiveType.NONE);
callerCustomMetadataContainer.putMetadataStringValue(entry.getKey(), entry.getValue(), TransitiveType.DISPOSABLE);
@@ -174,7 +173,7 @@ public final class MetadataContextHolder {
}
// caller application metadata to caller application disposable metadata
MetadataContainer callerApplicationMetadataContainer = metadataManager.getMetadataContainer(MetadataType.APPLICATION, true);
- if (!CollectionUtils.isEmpty(dynamicApplicationMetadata)) {
+ if (CollectionUtils.isNotEmpty(dynamicApplicationMetadata)) {
for (Map.Entry entry : dynamicApplicationMetadata.entrySet()) {
callerApplicationMetadataContainer.putMetadataStringValue(entry.getKey(), entry.getValue(), TransitiveType.DISPOSABLE);
}
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/StaticMetadataManager.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/StaticMetadataManager.java
index 7ba43dddf..03d1f0371 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/StaticMetadataManager.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/metadata/StaticMetadataManager.java
@@ -29,12 +29,11 @@ import java.util.stream.Collectors;
import com.tencent.cloud.common.metadata.config.MetadataLocalProperties;
import com.tencent.cloud.common.spi.InstanceMetadataProvider;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.util.CollectionUtils;
-
/**
* manage metadata from env/config file/custom spi.
*
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/pojo/PolarisServer.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/pojo/PolarisServer.java
index 623efe5ae..f726f330e 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/pojo/PolarisServer.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/pojo/PolarisServer.java
@@ -23,7 +23,8 @@ import java.util.Objects;
import com.netflix.loadbalancer.Server;
import com.tencent.polaris.api.pojo.Instance;
import com.tencent.polaris.api.pojo.ServiceInstances;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.StringUtils;
+
/**
* Polaris' implementation of {@link Server}.
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/pojo/PolarisServiceInstance.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/pojo/PolarisServiceInstance.java
index 760a3f3b7..4c2248263 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/pojo/PolarisServiceInstance.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/pojo/PolarisServiceInstance.java
@@ -24,7 +24,7 @@ import java.util.Objects;
import com.tencent.polaris.api.pojo.Instance;
import com.tencent.polaris.api.utils.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/rule/Operation.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/rule/Operation.java
index bb7072870..47598850a 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/rule/Operation.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/rule/Operation.java
@@ -20,9 +20,9 @@ package com.tencent.cloud.common.rule;
import java.util.List;
import java.util.regex.Pattern;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
-import org.springframework.util.CollectionUtils;
/**
* The condition operation.
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/JacksonUtils.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/JacksonUtils.java
index 156069dc0..854f22a41 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/JacksonUtils.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/JacksonUtils.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import org.slf4j.Logger;
@@ -42,6 +43,10 @@ public final class JacksonUtils {
private static final Logger LOG = LoggerFactory.getLogger(JacksonUtils.class);
+ static {
+ OM.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ }
+
private JacksonUtils() {
}
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/OkHttpUtil.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/OkHttpUtil.java
index 61a9d11cd..e6c29543e 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/OkHttpUtil.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/OkHttpUtil.java
@@ -24,11 +24,11 @@ import java.net.URL;
import java.util.Map;
import java.util.concurrent.TimeUnit;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
/**
* okhttp util.
@@ -61,7 +61,7 @@ public final class OkHttpUtil {
conn.setRequestMethod("GET");
conn.setConnectTimeout((int) TimeUnit.SECONDS.toMillis(2));
conn.setReadTimeout((int) TimeUnit.SECONDS.toMillis(2));
- if (!CollectionUtils.isEmpty(headers)) {
+ if (CollectionUtils.isNotEmpty(headers)) {
headers.forEach(conn::setRequestProperty);
}
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
@@ -71,7 +71,7 @@ public final class OkHttpUtil {
buffer.append(str);
}
String responseBody = buffer.toString();
- if (conn.getResponseCode() == 200 && StringUtils.hasText(responseBody)) {
+ if (conn.getResponseCode() == 200 && StringUtils.isNotBlank(responseBody)) {
LOGGER.debug("exec get request, url: {} success, response data: {}", url, responseBody);
return true;
}
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/ZuulFilterUtils.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/ZuulFilterUtils.java
index 15719ad54..178d64c7e 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/ZuulFilterUtils.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/ZuulFilterUtils.java
@@ -17,12 +17,13 @@
package com.tencent.cloud.common.util;
+
import java.net.URL;
import javax.servlet.http.HttpServletRequest;
import com.netflix.zuul.context.RequestContext;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionLabelUtils.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionLabelUtils.java
index ce5aefa58..3726d8d02 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionLabelUtils.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionLabelUtils.java
@@ -22,10 +22,9 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import io.netty.handler.codec.http.HttpHeaderNames;
-import org.apache.commons.lang.StringUtils;
-
-import org.springframework.util.CollectionUtils;
/**
* the utils for parse label expression.
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionParserV1.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionParserV1.java
index eebb99658..8fd5a271f 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionParserV1.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionParserV1.java
@@ -17,7 +17,7 @@
package com.tencent.cloud.common.util.expresstion;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.StringUtils;
/**
* Old custom expression resolver like ${http.query.key}、${http.header.key}.
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionParserV2.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionParserV2.java
index 5fabcd2ad..a6c233ff4 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionParserV2.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionParserV2.java
@@ -17,7 +17,7 @@
package com.tencent.cloud.common.util.expresstion;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.StringUtils;
/**
* New custom expression resolver like $query.key、$header.key.
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ServletExpressionLabelUtils.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ServletExpressionLabelUtils.java
index fe93b189c..54a28c14c 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ServletExpressionLabelUtils.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ServletExpressionLabelUtils.java
@@ -25,9 +25,9 @@ import java.util.Set;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
-import org.springframework.util.CollectionUtils;
/**
* Parse labels from HttpServletRequest.
diff --git a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/SpringWebExpressionLabelUtils.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/SpringWebExpressionLabelUtils.java
index f39764c14..6c57b0ed1 100644
--- a/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/SpringWebExpressionLabelUtils.java
+++ b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/SpringWebExpressionLabelUtils.java
@@ -22,13 +22,13 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import org.springframework.http.HttpCookie;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.server.reactive.ServerHttpRequest;
-import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap;
import org.springframework.web.server.ServerWebExchange;
diff --git a/spring-cloud-tencent-commons/src/main/java/org/springframework/tsf/core/entity/Tag.java b/spring-cloud-tencent-commons/src/main/java/org/springframework/tsf/core/entity/Tag.java
index b0348613e..eec2374da 100644
--- a/spring-cloud-tencent-commons/src/main/java/org/springframework/tsf/core/entity/Tag.java
+++ b/spring-cloud-tencent-commons/src/main/java/org/springframework/tsf/core/entity/Tag.java
@@ -22,9 +22,6 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
public class Tag implements Serializable {
/**
@@ -32,55 +29,10 @@ public class Tag implements Serializable {
*/
public static final int VERSION = 1;
- public enum ControlFlag {
-
- /**
- * tag transitive by all services.
- */
- @SerializedName("0")
- TRANSITIVE,
-
- /**
- * tag not used in auth.
- */
- @SerializedName("1")
- NOT_IN_AUTH,
-
- /**
- * tag not used in route.
- */
- @SerializedName("2")
- NOT_IN_ROUTE,
-
- /**
- * tag not used in trace.
- */
- @SerializedName("3")
- NOT_IN_SLEUTH,
-
- /**
- * tag not used in lane.
- */
- @SerializedName("4")
- NOT_IN_LANE,
-
- /**
- * tag not used in unit.
- */
- @SerializedName("5")
- IN_UNIT
- }
-
- @SerializedName("k")
- @Expose
private String key;
- @SerializedName("v")
- @Expose
private String value;
- @SerializedName("f")
- @Expose
private Set flags = new HashSet<>();
public Tag(String key, String value, ControlFlag... flags) {
@@ -131,7 +83,6 @@ public class Tag implements Serializable {
return (key == null ? 0 : key.hashCode()) + (flags == null ? 0 : flags.hashCode());
}
-
@Override
public String toString() {
return "Tag{" +
@@ -140,4 +91,38 @@ public class Tag implements Serializable {
", flags=" + flags +
'}';
}
+
+
+ public enum ControlFlag {
+
+ /**
+ * tag transitive by all services.
+ */
+ TRANSITIVE,
+
+ /**
+ * tag not used in auth.
+ */
+ NOT_IN_AUTH,
+
+ /**
+ * tag not used in route.
+ */
+ NOT_IN_ROUTE,
+
+ /**
+ * tag not used in trace.
+ */
+ NOT_IN_SLEUTH,
+
+ /**
+ * tag not used in lane.
+ */
+ NOT_IN_LANE,
+
+ /**
+ * tag not used in unit.
+ */
+ IN_UNIT
+ }
}
diff --git a/spring-cloud-tencent-coverage/pom.xml b/spring-cloud-tencent-coverage/pom.xml
index cc1115c65..9be11f8dc 100644
--- a/spring-cloud-tencent-coverage/pom.xml
+++ b/spring-cloud-tencent-coverage/pom.xml
@@ -8,6 +8,7 @@
${revision}
../pom.xml
+
4.0.0
spring-cloud-tencent-coverage
@@ -84,21 +85,11 @@
spring-cloud-starter-tencent-discovery-adapter-plugin
-
- com.tencent.cloud
- spring-cloud-tencent-featureenv-plugin
-
-
com.tencent.cloud
spring-cloud-starter-tencent-gateway-plugin
-
- com.tencent.cloud
- spring-cloud-starter-tencent-discovery-adapter-plugin
-
-
com.tencent.cloud
spring-cloud-tencent-lossless-plugin
diff --git a/spring-cloud-tencent-dependencies/pom.xml b/spring-cloud-tencent-dependencies/pom.xml
index f8d1c904e..2c57094be 100644
--- a/spring-cloud-tencent-dependencies/pom.xml
+++ b/spring-cloud-tencent-dependencies/pom.xml
@@ -81,15 +81,8 @@
4.5.1
1.12.19
2.15.3
- 3.21.7
- 2.9.9
2.0.2
1.33
- 2.9.1
- 2.1.10
- 6.2.5.Final
- 3.0.2
- 3.0.4
3.3.0
@@ -108,14 +101,7 @@
import
-
- polaris-dependencies
- com.tencent.polaris
- ${polaris.version}
- pom
- import
-
-
+
com.tencent.cloud
spring-cloud-tencent-commons
@@ -201,12 +187,6 @@
${revision}
-
- com.tencent.cloud
- spring-cloud-tencent-featureenv-plugin
- ${revision}
-
-
com.tencent.cloud
spring-cloud-starter-tencent-gateway-plugin
@@ -243,7 +223,6 @@
${revision}
-
com.google.guava
guava
@@ -264,49 +243,24 @@
-
- ch.qos.logback
- logback-core
- ${logback.version}
-
-
-
- ch.qos.logback
- logback-classic
- ${logback.version}
-
-
org.springdoc
- springdoc-openapi-ui
+ springdoc-openapi-webflux-ui
${springdoc.version}
org.springdoc
- springdoc-openapi-webflux-ui
+ springdoc-openapi-ui
${springdoc.version}
-
- com.google.protobuf
- protobuf-java
- ${protobuf-java.version}
-
-
net.bytebuddy
byte-buddy
${byte-buddy.version}
-
-
- joda-time
- joda-time
- ${joda-time.version}
-
-
org.yaml
snakeyaml
@@ -314,56 +268,57 @@
- com.google.code.gson
- gson
- ${gson.version}
+ org.mockito
+ mockito-inline
+ ${mocktio.version}
+ test
- org.hdrhistogram
- HdrHistogram
- ${HdrHistogram.version}
+ org.mockito
+ mockito-core
+ ${mocktio.version}
+ test
- org.hibernate.validator
- hibernate-validator
- ${hibernate-validator.version}
+ uk.org.webcompere
+ system-stubs-jupiter
+ ${system-stubs-jupiter.version}
+ test
+
- com.google.code.findbugs
- jsr305
- ${jsr305.version}
+ polaris-all
+ com.tencent.polaris
+ ${polaris.version}
- org.glassfish
- jakarta.el
- ${jakarta.el.version}
+ polaris-threadlocal
+ com.tencent.polaris
+ ${polaris.version}
- org.mockito
- mockito-inline
- ${mocktio.version}
- test
+ com.tencent.polaris
+ connector-nacos
+ ${polaris.version}
- org.mockito
- mockito-core
- ${mocktio.version}
+ com.tencent.polaris
+ polaris-test-common
+ ${polaris.version}
test
-
- uk.org.webcompere
- system-stubs-jupiter
- ${system-stubs-jupiter.version}
+ com.tencent.polaris
+ polaris-test-mock-discovery
+ ${polaris.version}
test
-
diff --git a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/src/main/java/com/tencent/cloud/metadata/service/frontend/MetadataMiddleServiceFallback.java b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/src/main/java/com/tencent/cloud/metadata/service/frontend/MetadataMiddleServiceFallback.java
index 444d1513c..d5b81019f 100644
--- a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/src/main/java/com/tencent/cloud/metadata/service/frontend/MetadataMiddleServiceFallback.java
+++ b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/src/main/java/com/tencent/cloud/metadata/service/frontend/MetadataMiddleServiceFallback.java
@@ -17,10 +17,9 @@
package com.tencent.cloud.metadata.service.frontend;
+import java.util.HashMap;
import java.util.Map;
-import com.google.common.collect.Maps;
-
import org.springframework.stereotype.Component;
/**
@@ -33,6 +32,6 @@ public class MetadataMiddleServiceFallback implements MetadataMiddleService {
@Override
public Map> info() {
- return Maps.newHashMap();
+ return new HashMap<>();
}
}
diff --git a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/src/main/java/com/tencent/cloud/metadata/service/middle/MetadataBackendServiceFallback.java b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/src/main/java/com/tencent/cloud/metadata/service/middle/MetadataBackendServiceFallback.java
index 3d53dd227..e5d0018f3 100644
--- a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/src/main/java/com/tencent/cloud/metadata/service/middle/MetadataBackendServiceFallback.java
+++ b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/src/main/java/com/tencent/cloud/metadata/service/middle/MetadataBackendServiceFallback.java
@@ -17,10 +17,9 @@
package com.tencent.cloud.metadata.service.middle;
+import java.util.HashMap;
import java.util.Map;
-import com.google.common.collect.Maps;
-
import org.springframework.stereotype.Component;
/**
@@ -33,6 +32,6 @@ public class MetadataBackendServiceFallback implements MetadataBackendService {
@Override
public Map> info() {
- return Maps.newHashMap();
+ return new HashMap<>();
}
}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/README-zh.md b/spring-cloud-tencent-examples/polaris-router-featureenv-example/README-zh.md
deleted file mode 100644
index 63b19bd1c..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/README-zh.md
+++ /dev/null
@@ -1,174 +0,0 @@
-# 多测试环境样例说明
-
-[English](./README.md) | 简体中文
-
-## 一、部署结构
-
-
-
-如上图所示,一共有三个环境:
-
-1. 基线环境,包含 FrontService、MiddleService、BackendService
-2. feature1 环境,包含 MiddleService、BackendService
-3. feature2 环境,包含 FrontService、BackendService
-
-并且在入口处,部署网关服务。
-
-三条请求链路:
-
-1. 基线环境链路,Gateway -> FrontService(基线) -> MiddleService(基线) -> BackendService(基线)
-2. feature1 环境链路,Gateway -> FrontService(基线) -> MiddleService(feature1) -> BackendService(feature1)
-3. feature2 环境链路,Gateway -> FrontService(feature2) -> MiddleService(基线) -> BackendService(feature2)
-
-## 二、运行样例
-
-无需任何代码变更,直接启动 base、feature1、feature2、featureenv-gateway 下所有应用即可。
-
-应用默认指向北极星官方的体验环境,启动成功后可直接到体验站点查看服务注册数据。
-
-- 管控台地址: http://119.91.66.223:8080/
- - 账号:polaris
- - 密码:polaris
-
-## 三、测试
-
-### 方式一:客户端打标
-
-#### 基线环境链路
-
-````
-curl http://127.0.0.1:9999/featureenv-front-example/router/rest
-````
-
-响应结果(base 表示基线环境)
-
-````
-featureenv-front-example[base] -> featureenv-middle-example[base] -> featureenv-backend-example[base]
-````
-
-#### feature1 环境链路
-
-通过 X-Polaris-Metadata-Transitive-featureenv 请求头指定特性环境。
-
-````
-curl -H'X-Polaris-Metadata-Transitive-featureenv:feature1' http://127.0.0.1:9999/featureenv-front-example/router/rest
-````
-
-响应结果
-
-````
-featureenv-front-example[base] -> featureenv-middle-example[feature1] -> featureenv-backend-example[feature1]
-````
-
-#### feature2 环境链路
-
-通过 X-Polaris-Metadata-Transitive-featureenv 请求头指定特性环境。
-
-````
-curl -H'X-Polaris-Metadata-Transitive-featureenv:feature2' http://127.0.0.1:9999/featureenv-front-example/router/rest
-````
-
-响应结果
-
-````
-featureenv-front-example[feature2] -> featureenv-middle-example[base] -> featureenv-backend-example[feature2]
-````
-
-### 方式二:网关流量染色
-
-模拟一种实际的场景,假设客户端请求有一个 uid 请求参数,期望:
-
-1. uid=1000 的请求打到 feature1 环境
-2. uid=2000 的请求打到 feature2 环境
-3. 其它 uid 的请求打到基线环境
-
-**配置染色规则**
-
-配置地址:http://119.91.66.223:8080/#/filegroup-detail?group=featureenv-gateway&namespace=default
-
-修改 rule/staining.json 配置文件,填写以下规则:
-
-````json
-{
- "rules": [
- {
- "conditions": [
- {
- "key": "${http.query.uid}",
- "values": [
- "1000"
- ],
- "operation": "EQUALS"
- }
- ],
- "labels": [
- {
- "key": "featureenv",
- "value": "feature1"
- }
- ]
- },
- {
- "conditions": [
- {
- "key": "${http.query.uid}",
- "values": [
- "2000"
- ],
- "operation": "EQUALS"
- }
- ],
- "labels": [
- {
- "key": "featureenv",
- "value": "feature2"
- }
- ]
- }
- ]
-}
-````
-
-填写完后发布配置即可。
-
-#### 基线环境链路
-
-````
-curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=3000
-````
-
-响应结果(base 表示基线环境)
-
-````
-featureenv-front-example[base] -> featureenv-middle-example[base] -> featureenv-backend-example[base]
-````
-
-#### feature1 环境链路
-
-通过 X-Polaris-Metadata-Transitive-featureenv 请求头指定特性环境。
-
-````
-curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=1000
-````
-
-响应结果
-
-````
-featureenv-front-example[base] -> featureenv-middle-example[feature1] -> featureenv-backend-example[feature1]
-````
-
-#### feature2 环境链路
-
-通过 X-Polaris-Metadata-Transitive-featureenv 请求头指定特性环境。
-
-````
-curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=2000
-````
-
-响应结果
-
-````
-featureenv-front-example[feature2] -> featureenv-middle-example[base] -> featureenv-backend-example[feature2]
-````
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/README.md b/spring-cloud-tencent-examples/polaris-router-featureenv-example/README.md
deleted file mode 100644
index d79cec4a4..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/README.md
+++ /dev/null
@@ -1,179 +0,0 @@
-## A Multi-Feature Environment Example
-
-English | [简体中文](./README-zh.md)
-
-## I. Deployment Structure
-
-
-
-As shown in the figure above, there are three environments.
-
-1. `baseline` environment, including `FrontService`, `MiddleService`, `BackendService`
-2. `feature1` environment, including `MiddleService`, `BackendService`
-3. `feature2` environment, including `FrontService`, `BackendService`
-
-And at the entrance, deploy the `gateway` service.
-
-Three request links.
-
-1. `baseline` environment link, `Gateway` -> `FrontService`(baseline) -> `MiddleService`(baseline) -> `BackendService`(
- baseline)
-2. `feature1` environment link, `Gateway` -> `FrontService`(baseline) -> `MiddleService`(feature1) -> `BackendService`(
- feature1)
-3. `feature2` environment link, `Gateway` -> `FrontService`(feature2) -> `MiddleService`(baseline) -> `BackendService`(
- feature2)
-
-## II. Running
-
-Without any code changes, just start all the applications under `base`, `feature1`, `feature2`, `featureenv-gateway`
-directly.
-
-By default, the applications point to the official Polaris experience environment, and you can directly view the service
-registration data at the experience site after a successful launch.
-
-- Console address: http://119.91.66.223:8080/
- - Account: polaris
- - Password: polaris
-
-## III. Testing
-
-### Mode 1: Client Request With `featureenv` Label
-
-#### `baseline` environment link
-
-````
-curl http://127.0.0.1:9999/featureenv-front-example/router/rest
-````
-
-Response results (base indicates baseline environment)
-
-````
-featureenv-front-example[base] -> featureenv-middle-example[base] -> featureenv-backend-example[base]
-````
-
-#### `feature1` environment link
-
-Specify the feature environment via the `X-Polaris-Metadata-Transitive-featureenv` request header.
-
-````
-curl -H'X-Polaris-Metadata-Transitive-featureenv:feature1' http://127.0.0.1:9999/featureenv-front-example/router/rest
-````
-
-Response results
-
-````
-featureenv-front-example[base] -> featureenv-middle-example[feature1] -> featureenv-backend-example[feature1]
-````
-
-#### `feature2` environment link
-
-Specify the feature environment via the `X-Polaris-Metadata-Transitive-featureenv` request header.
-
-````
-curl -H'X-Polaris-Metadata-Transitive-featureenv:feature2' http://127.0.0.1:9999/featureenv-front-example/router/rest
-````
-
-Response results
-
-````
-featureenv-front-example[feature2] -> featureenv-middle-example[base] -> featureenv-backend-example[feature2]
-````
-
-### Mode 2: Gateway traffic staining
-
-Simulate a real-world scenario, assuming that the client request has a uid request parameter and expects:
-
-1. `uid=1000` requests hit the `feature1` environment
-2. `uid=2000` requests hit the `feature2` environment
-3. requests with other uid hit the `baseline` environment
-
-**Configure coloring rules**
-
-Polaris Configuration Address: http://119.91.66.223:8080/#/filegroup-detail?group=featureenv-gateway&namespace=default
-
-Modify the `rule/staining.json` configuration file and fill in the following rule:
-
-````json
-{
- "rules": [
- {
- "conditions": [
- {
- "key": "${http.query.uid}",
- "values": [
- "1000"
- ],
- "operation": "EQUALS"
- }
- ],
- "labels": [
- {
- "key": "featureenv",
- "value": "feature1"
- }
- ]
- },
- {
- "conditions": [
- {
- "key": "${http.query.uid}",
- "values": [
- "2000"
- ],
- "operation": "EQUALS"
- }
- ],
- "labels": [
- {
- "key": "featureenv",
- "value": "feature2"
- }
- ]
- }
- ]
-}
-````
-
-Just fill out and publish the configuration.
-
-#### `baseline` Environment Link
-
-````
-curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=3000
-````
-
-Response results (base indicates baseline environment)
-
-````
-featureenv-front-example[base] -> featureenv-middle-example[base] -> featureenv-backend-example[base]
-````
-
-#### `feature1` Environment Link
-
-Specify the feature environment via the `X-Polaris-Metadata-Transitive-featureenv` request header.
-
-````
-curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=1000
-````
-
-Response results
-
-````
-featureenv-front-example[base] -> featureenv-middle-example[feature1] -> featureenv-backend-example[feature1]
-````
-
-#### `feature2` Environment Link
-
-Specify the feature environment via the `X-Polaris-Metadata-Transitive-featureenv` request header.
-
-````
-curl http://127.0.0.1:9999/featureenv-front-example/router/rest?uid=2000
-````
-
-Response results
-
-````
-featureenv-front-example[feature2] -> featureenv-middle-example[base] -> featureenv-backend-example[feature2]
-````
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/pom.xml
deleted file mode 100644
index 4b1c3d1e4..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/pom.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- base
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- base-backend
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/basebackend/BackendController.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/basebackend/BackendController.java
deleted file mode 100644
index 83849c940..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/basebackend/BackendController.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.basebackend;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author lepdou 2022-07-20
- */
-@RestController
-@RequestMapping("/router")
-public class BackendController {
-
- @Value("${spring.application.name}")
- private String appName;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @GetMapping("/rest")
- public String rest() {
- return appName + "[base]";
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/basebackend/BaseBackendApplication.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/basebackend/BaseBackendApplication.java
deleted file mode 100644
index 7eb6d43e4..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/basebackend/BaseBackendApplication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.basebackend;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-
-/**
- * @author lepdou 2022-07-20
- */
-@SpringBootApplication
-@EnableFeignClients
-public class BaseBackendApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(BaseBackendApplication.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/src/main/resources/bootstrap.yml
deleted file mode 100644
index 4ee62a478..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-backend/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-server:
- session-timeout: 1800
- port: 10002
-spring:
- application:
- name: featureenv-backend-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
-logging:
- level:
- org.springframework.cloud.gateway: info
- com.tencent.cloud.polaris: debug
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/pom.xml
deleted file mode 100644
index 38e365cf5..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/pom.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- base
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- base-front
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/basefront/BaseFrontApplication.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/basefront/BaseFrontApplication.java
deleted file mode 100644
index bdc7b90e6..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/basefront/BaseFrontApplication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.basefront;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-
-/**
- * @author lepdou 2022-07-20
- */
-@SpringBootApplication
-@EnableFeignClients
-public class BaseFrontApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(BaseFrontApplication.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/basefront/FrontController.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/basefront/FrontController.java
deleted file mode 100644
index b0226c362..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/basefront/FrontController.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.basefront;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author lepdou 2022-07-20
- */
-@RestController
-@RequestMapping("/router")
-public class FrontController {
-
- @Value("${spring.application.name}")
- private String appName;
-
- @Autowired
- private MiddleService middleService;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @GetMapping("/rest")
- public String rest() {
- String curName = appName + "[base]";
- String resp = middleService.rest();
-
- return curName + " -> " + resp;
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/basefront/MiddleService.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/basefront/MiddleService.java
deleted file mode 100644
index 7370da0b7..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/basefront/MiddleService.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.basefront;
-
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-
-/**
- * @author lepdou 2022-07-20
- */
-@FeignClient("featureenv-middle-example")
-public interface MiddleService {
-
- @GetMapping("/router/rest")
- String rest();
-
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/resources/bootstrap.yml
deleted file mode 100644
index f97f3cc87..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-front/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-server:
- session-timeout: 1800
- port: 10000
-spring:
- application:
- name: featureenv-front-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
-logging:
- level:
- org.springframework.cloud.gateway: info
- com.tencent.cloud.polaris: debug
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/pom.xml
deleted file mode 100644
index 8b0ed0024..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/pom.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- base
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
-
- 4.0.0
-
- base-middle
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/basemiddle/BackendService.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/basemiddle/BackendService.java
deleted file mode 100644
index 0abc4bcee..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/basemiddle/BackendService.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.basemiddle;
-
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-
-/**
- * @author lepdou 2022-07-20
- */
-@FeignClient("featureenv-backend-example")
-public interface BackendService {
-
- @GetMapping("/router/rest")
- String rest();
-
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/basemiddle/BaseMiddleApplication.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/basemiddle/BaseMiddleApplication.java
deleted file mode 100644
index 9d6d99351..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/basemiddle/BaseMiddleApplication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.basemiddle;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-
-/**
- * @author lepdou 2022-07-20
- */
-@SpringBootApplication
-@EnableFeignClients
-public class BaseMiddleApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(BaseMiddleApplication.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/basemiddle/MiddleController.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/basemiddle/MiddleController.java
deleted file mode 100644
index d12e18cb8..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/basemiddle/MiddleController.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.basemiddle;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author lepdou 2022-07-20
- */
-@RestController
-@RequestMapping("/router")
-public class MiddleController {
-
- @Value("${spring.application.name}")
- private String appName;
-
- @Autowired
- private BackendService backendService;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @GetMapping("/rest")
- public String rest() {
- String curName = appName + "[base]";
- String resp = backendService.rest();
-
- return curName + " -> " + resp;
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/resources/bootstrap.yml
deleted file mode 100644
index dc245a379..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/base-middle/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-server:
- session-timeout: 1800
- port: 10001
-spring:
- application:
- name: featureenv-middle-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
-logging:
- level:
- org.springframework.cloud.gateway: info
- com.tencent.cloud.polaris: debug
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/pom.xml
deleted file mode 100644
index 0dc0c3d3d..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/base/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- polaris-router-featureenv-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- base
- pom
-
-
- base-front
- base-middle
- base-backend
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.cloud
- spring-cloud-starter-openfeign
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/pom.xml
deleted file mode 100644
index 57fa48b17..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/pom.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- feature1
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- feature1-backend
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1backend/BackendController.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1backend/BackendController.java
deleted file mode 100644
index 3d83011f1..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1backend/BackendController.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.feature1backend;
-
-import com.tencent.cloud.common.metadata.StaticMetadataManager;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author lepdou 2022-07-20
- */
-@RestController
-@RequestMapping("/router")
-public class BackendController {
-
- @Autowired
- private StaticMetadataManager staticMetadataManager;
-
- @Value("${spring.application.name}")
- private String appName;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @GetMapping("/rest")
- public String rest() {
- String featureEnv = staticMetadataManager.getMergedStaticMetadata().get("featureenv");
- return appName + "[" + featureEnv + "]";
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1backend/Feature1BackendApplication.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1backend/Feature1BackendApplication.java
deleted file mode 100644
index e260c0616..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1backend/Feature1BackendApplication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.feature1backend;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-
-/**
- * @author lepdou 2022-07-20
- */
-@SpringBootApplication
-@EnableFeignClients
-public class Feature1BackendApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(Feature1BackendApplication.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/src/main/resources/bootstrap.yml
deleted file mode 100644
index f5d64a10e..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-backend/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-server:
- session-timeout: 1800
- port: 11002
-spring:
- application:
- name: featureenv-backend-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- tencent:
- metadata:
- content:
- featureenv: feature1
-logging:
- level:
- org.springframework.cloud.gateway: info
- com.tencent.cloud.polaris: debug
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/pom.xml
deleted file mode 100644
index 873bd1394..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/pom.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- feature1
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- feature1-middle
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1middle/BackendService.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1middle/BackendService.java
deleted file mode 100644
index 5d6209252..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1middle/BackendService.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.feature1middle;
-
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-
-/**
- * @author lepdou 2022-07-20
- */
-@FeignClient("featureenv-backend-example")
-public interface BackendService {
-
- @GetMapping("/router/rest")
- String rest();
-
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1middle/Feature1MiddleApplication.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1middle/Feature1MiddleApplication.java
deleted file mode 100644
index 76a80726b..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1middle/Feature1MiddleApplication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.feature1middle;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-
-/**
- * @author lepdou 2022-07-20
- */
-@SpringBootApplication
-@EnableFeignClients
-public class Feature1MiddleApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(Feature1MiddleApplication.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1middle/MiddleController.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1middle/MiddleController.java
deleted file mode 100644
index 1b40723b8..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature1middle/MiddleController.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.feature1middle;
-
-import com.tencent.cloud.common.metadata.StaticMetadataManager;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author lepdou 2022-07-20
- */
-@RestController
-@RequestMapping("/router")
-public class MiddleController {
-
- @Value("${spring.application.name}")
- private String appName;
-
- @Autowired
- private BackendService backendService;
-
- @Autowired
- private StaticMetadataManager staticMetadataManager;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @GetMapping("/rest")
- public String rest() {
- String featureEnv = staticMetadataManager.getMergedStaticMetadata().get("featureenv");
-
- String curName = appName + "[" + featureEnv + "]";
- String resp = backendService.rest();
-
- return curName + " -> " + resp;
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/resources/bootstrap.yml
deleted file mode 100644
index ddf1b5394..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/feature1-middle/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-server:
- session-timeout: 1800
- port: 11001
-spring:
- application:
- name: featureenv-middle-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- tencent:
- metadata:
- content:
- featureenv: feature1
-logging:
- level:
- org.springframework.cloud.gateway: info
- com.tencent.cloud.polaris: debug
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/pom.xml
deleted file mode 100644
index b364b109c..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature1/pom.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- polaris-router-featureenv-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- feature1
- pom
-
-
- feature1-middle
- feature1-backend
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.cloud
- spring-cloud-starter-openfeign
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/pom.xml
deleted file mode 100644
index bc2f20a6f..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/pom.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- feature2
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- feature2-backend
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2backend/BackendController.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2backend/BackendController.java
deleted file mode 100644
index d767659aa..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2backend/BackendController.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.feature2backend;
-
-import com.tencent.cloud.common.metadata.StaticMetadataManager;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author lepdou 2022-07-20
- */
-@RestController
-@RequestMapping("/router")
-public class BackendController {
-
- @Autowired
- private StaticMetadataManager staticMetadataManager;
-
- @Value("${spring.application.name}")
- private String appName;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @GetMapping("/rest")
- public String rest() {
- String featureEnv = staticMetadataManager.getMergedStaticMetadata().get("featureenv");
- return appName + "[" + featureEnv + "]";
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2backend/Feature2BackendApplication.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2backend/Feature2BackendApplication.java
deleted file mode 100644
index 6a0b1a65b..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2backend/Feature2BackendApplication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.feature2backend;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-
-/**
- * @author lepdou 2022-07-20
- */
-@SpringBootApplication
-@EnableFeignClients
-public class Feature2BackendApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(Feature2BackendApplication.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/src/main/resources/bootstrap.yml
deleted file mode 100644
index 2803ce6bb..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-backend/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-server:
- session-timeout: 1800
- port: 12002
-spring:
- application:
- name: featureenv-backend-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- tencent:
- metadata:
- content:
- featureenv: feature2
-logging:
- level:
- org.springframework.cloud.gateway: info
- com.tencent.cloud.polaris: debug
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/pom.xml
deleted file mode 100644
index fb4268738..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/pom.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- feature2
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- feature2-front
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2front/Feature2FrontApplication.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2front/Feature2FrontApplication.java
deleted file mode 100644
index 23bd37c7d..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2front/Feature2FrontApplication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.feature2front;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-
-/**
- * @author lepdou 2022-07-20
- */
-@SpringBootApplication
-@EnableFeignClients
-public class Feature2FrontApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(Feature2FrontApplication.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2front/FrontController.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2front/FrontController.java
deleted file mode 100644
index 7dd64d18c..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2front/FrontController.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.feature2front;
-
-import com.tencent.cloud.common.metadata.StaticMetadataManager;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author lepdou 2022-07-20
- */
-@RestController
-@RequestMapping("/router")
-public class FrontController {
-
- @Autowired
- private StaticMetadataManager staticMetadataManager;
-
- @Value("${spring.application.name}")
- private String appName;
-
- @Autowired
- private MiddleService middleService;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @GetMapping("/rest")
- public String rest() {
- String featureEnv = staticMetadataManager.getMergedStaticMetadata().get("featureenv");
-
- String curName = appName + "[" + featureEnv + "]";
- String resp = middleService.rest();
-
- return curName + " -> " + resp;
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2front/MiddleService.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2front/MiddleService.java
deleted file mode 100644
index 436f6d38d..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/java/com/tencent/cloud/polaris/router/featureenv/feature2front/MiddleService.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.router.featureenv.feature2front;
-
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-
-/**
- * @author lepdou 2022-07-20
- */
-@FeignClient("featureenv-middle-example")
-public interface MiddleService {
-
- @GetMapping("/router/rest")
- String rest();
-
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/resources/bootstrap.yml
deleted file mode 100644
index 6937fc89f..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/feature2-front/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-server:
- session-timeout: 1800
- port: 12000
-spring:
- application:
- name: featureenv-front-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- tencent:
- metadata:
- content:
- featureenv: feature2
-logging:
- level:
- org.springframework.cloud.gateway: info
- com.tencent.cloud.polaris: debug
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/pom.xml
deleted file mode 100644
index f14cbd7d6..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/feature2/pom.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- polaris-router-featureenv-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- feature2
- pom
-
-
- feature2-front
- feature2-backend
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.cloud
- spring-cloud-starter-openfeign
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/featureenv-gateway/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/featureenv-gateway/pom.xml
deleted file mode 100644
index 698a9567e..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/featureenv-gateway/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
- polaris-router-featureenv-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- featureenv-gateway
-
-
-
-
- org.springframework.cloud
- spring-cloud-starter-gateway
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-gateway-plugin
-
-
- com.tencent.cloud
- spring-cloud-tencent-featureenv-plugin
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/featureenv-gateway/src/main/java/com/tencent/cloud/polaris/featureenv/gateway/FeatureEnvScgApplication.java b/spring-cloud-tencent-examples/polaris-router-featureenv-example/featureenv-gateway/src/main/java/com/tencent/cloud/polaris/featureenv/gateway/FeatureEnvScgApplication.java
deleted file mode 100644
index 9a0b6a123..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/featureenv-gateway/src/main/java/com/tencent/cloud/polaris/featureenv/gateway/FeatureEnvScgApplication.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.polaris.featureenv.gateway;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * @author lepdou 2022-07-20
- */
-@SpringBootApplication
-public class FeatureEnvScgApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(FeatureEnvScgApplication.class, args);
- }
-
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/featureenv-gateway/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/featureenv-gateway/src/main/resources/bootstrap.yml
deleted file mode 100644
index 9326f11e9..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/featureenv-gateway/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,68 +0,0 @@
-server:
- session-timeout: 1800
- port: 9999
-spring:
- application:
- name: featureenv-gateway
- cloud:
- tencent:
- plugin:
- scg:
- staining:
- enabled: true
- rule-staining:
- enabled: true
- router:
- feature-env:
- enabled: true
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- gateway:
- discovery:
- locator:
- enabled: true
- 'predicates[0]':
- name: Path
- args:
- patterns: '''/'' + serviceId + ''/**'''
- 'filters[0]':
- name: RewritePath
- args:
- regexp: '''/'' + serviceId + ''/(?.*)'''
- replacement: '''/$\{remaining}'''
- 'filters[1]':
- name: Retry
- args:
- retries: 3
- exceptions:
- '[0]': '''java.net.ConnectException'''
- '[1]': '''java.io.IOException'''
- statuses:
- '[0]': '''BAD_GATEWAY'''
- '[1]': '''SERVICE_UNAVAILABLE'''
- series:
- '[0]': '''CLIENT_ERROR'''
- methods:
- '[0]': '''GET'''
- '[1]': '''POST'''
- '[2]': '''PUT'''
- '[3]': '''DELETE'''
- backoff:
- firstBackoff: '''100ms'''
- maxBackoff: '''500ms'''
- factor: 2
- basedOnPreviousValue: false
- routes:
- - id: featureenv-front-example
- uri: lb://featureenv-front-example
- predicates:
- - Path=/featureenv-front-example/**
- filters:
- - StripPrefix=1
-
-logging:
- level:
- org.springframework.cloud.gateway: info
- com.tencent.cloud.polaris: debug
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/imgs/structs.png b/spring-cloud-tencent-examples/polaris-router-featureenv-example/imgs/structs.png
deleted file mode 100644
index 2b8a9c8a1..000000000
Binary files a/spring-cloud-tencent-examples/polaris-router-featureenv-example/imgs/structs.png and /dev/null differ
diff --git a/spring-cloud-tencent-examples/polaris-router-featureenv-example/pom.xml b/spring-cloud-tencent-examples/polaris-router-featureenv-example/pom.xml
deleted file mode 100644
index c9308f4ba..000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/pom.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
- spring-cloud-tencent-examples
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- polaris-router-featureenv-example
- pom
-
-
- base
- feature1
- feature2
- featureenv-gateway
-
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
- com.tencent.cloud
- spring-cloud-tencent-featureenv-plugin
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/pom.xml b/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/pom.xml
index 6f602207d..085bb8fc1 100644
--- a/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/pom.xml
+++ b/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/pom.xml
@@ -1,6 +1,6 @@
-
spring-cloud-tencent-examples
@@ -15,7 +15,6 @@
4.0.0
- com.tencent.polaris
polaris-router-grayrelease-lane-example
pom
diff --git a/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-callee-service/pom.xml b/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-callee-service/pom.xml
index 3431f03d0..b54fc993c 100644
--- a/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-callee-service/pom.xml
+++ b/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-callee-service/pom.xml
@@ -1,10 +1,10 @@
-
4.0.0
- com.tencent.polaris
+ com.tencent.cloud
polaris-router-grayrelease-lane-example
${revision}
../pom.xml
diff --git a/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-caller-service/pom.xml b/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-caller-service/pom.xml
index f1a48d81b..e24c80179 100644
--- a/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-caller-service/pom.xml
+++ b/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-caller-service/pom.xml
@@ -1,10 +1,10 @@
-
4.0.0
- com.tencent.polaris
+ com.tencent.cloud
polaris-router-grayrelease-lane-example
${revision}
../pom.xml
diff --git a/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-gateway/pom.xml b/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-gateway/pom.xml
index efd0edff1..81e3214b4 100644
--- a/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-gateway/pom.xml
+++ b/spring-cloud-tencent-examples/polaris-router-grayrelease-lane-example/router-grayrelease-lane-gateway/pom.xml
@@ -1,10 +1,10 @@
-
4.0.0
- com.tencent.polaris
+ com.tencent.cloud
polaris-router-grayrelease-lane-example
${revision}
../pom.xml
diff --git a/spring-cloud-tencent-examples/pom.xml b/spring-cloud-tencent-examples/pom.xml
index 8eccfd444..76f0fedcb 100644
--- a/spring-cloud-tencent-examples/pom.xml
+++ b/spring-cloud-tencent-examples/pom.xml
@@ -19,7 +19,6 @@
multiple-discovery-example
metadata-transfer-example
polaris-router-grayrelease-example
- polaris-router-featureenv-example
quickstart-example
lossless-example
polaris-router-grayrelease-lane-example
@@ -29,4 +28,27 @@
true
+
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/pom.xml b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/pom.xml
index ce6588118..65a869a81 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/pom.xml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/pom.xml
@@ -29,33 +29,4 @@
spring-boot-starter-actuator
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.0
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/pom.xml b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/pom.xml
index 0f3495e9e..ac9097549 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/pom.xml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/pom.xml
@@ -29,33 +29,4 @@
spring-boot-starter-actuator
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.0
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/pom.xml b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/pom.xml
index cc72331c6..1c4860a58 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/pom.xml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/pom.xml
@@ -39,33 +39,4 @@
spring-boot-starter-actuator
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.0
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/pom.xml b/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/pom.xml
index 4428cc570..81e4e1df9 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/pom.xml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/pom.xml
@@ -19,43 +19,9 @@
spring-cloud-starter-tencent-all
-
- com.tencent.cloud
- spring-cloud-starter-tencent-gateway-plugin
-
-
org.springframework.cloud
spring-cloud-starter-gateway
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.0
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/tsf-example/consumer-demo/pom.xml b/spring-cloud-tencent-examples/tsf-example/consumer-demo/pom.xml
index ca0dc4358..04f4a8314 100644
--- a/spring-cloud-tencent-examples/tsf-example/consumer-demo/pom.xml
+++ b/spring-cloud-tencent-examples/tsf-example/consumer-demo/pom.xml
@@ -27,33 +27,4 @@
spring-cloud-starter-openfeign
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.0
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
\ No newline at end of file
diff --git a/spring-cloud-tencent-examples/tsf-example/provider-demo/pom.xml b/spring-cloud-tencent-examples/tsf-example/provider-demo/pom.xml
index 88adb4e5e..4a714aded 100644
--- a/spring-cloud-tencent-examples/tsf-example/provider-demo/pom.xml
+++ b/spring-cloud-tencent-examples/tsf-example/provider-demo/pom.xml
@@ -25,33 +25,4 @@
spring-boot-starter-actuator
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.0
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
\ No newline at end of file
diff --git a/spring-cloud-tencent-examples/tsf-example/provider-demo/src/main/java/com/tencent/cloud/tsf/demo/provider/swagger/controller/SwaggerApiController.java b/spring-cloud-tencent-examples/tsf-example/provider-demo/src/main/java/com/tencent/cloud/tsf/demo/provider/swagger/controller/SwaggerApiController.java
index f898637cb..6a2656fd7 100644
--- a/spring-cloud-tencent-examples/tsf-example/provider-demo/src/main/java/com/tencent/cloud/tsf/demo/provider/swagger/controller/SwaggerApiController.java
+++ b/spring-cloud-tencent-examples/tsf-example/provider-demo/src/main/java/com/tencent/cloud/tsf/demo/provider/swagger/controller/SwaggerApiController.java
@@ -18,11 +18,11 @@
package com.tencent.cloud.tsf.demo.provider.swagger.controller;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import com.google.common.collect.Lists;
import com.tencent.cloud.tsf.demo.provider.swagger.model.MessageBox;
import com.tencent.cloud.tsf.demo.provider.swagger.model.MessageModel;
import com.tencent.cloud.tsf.demo.provider.swagger.model.MessageUser;
@@ -66,7 +66,7 @@ public class SwaggerApiController {
messageReceiver.setName("拜登");
messageReceiver.setOfficeAddress("华盛顿白宫");
messageReceiver.setPhoneNum("911911911");
- messageModel.setReceiveUsers(Lists.newArrayList(messageReceiver));
+ messageModel.setReceiveUsers(Collections.singletonList(messageReceiver));
messageModels.add(messageModel);
return messageModels;
}
@@ -103,7 +103,7 @@ public class SwaggerApiController {
messageReceiver.setName("拜登");
messageReceiver.setOfficeAddress("华盛顿白宫");
messageReceiver.setPhoneNum("911911911");
- messageModel.setReceiveUsers(Lists.newArrayList(messageReceiver));
+ messageModel.setReceiveUsers(Collections.singletonList(messageReceiver));
return messageModel;
}
diff --git a/spring-cloud-tencent-plugin-starters/pom.xml b/spring-cloud-tencent-plugin-starters/pom.xml
index 67ad734d8..1ba1a6322 100644
--- a/spring-cloud-tencent-plugin-starters/pom.xml
+++ b/spring-cloud-tencent-plugin-starters/pom.xml
@@ -15,7 +15,6 @@
Spring Cloud Starter Tencent Solution
- spring-cloud-tencent-featureenv-plugin
spring-cloud-starter-tencent-gateway-plugin
spring-cloud-starter-tencent-discovery-adapter-plugin
spring-cloud-tencent-lossless-plugin
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/pom.xml b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/pom.xml
index 5638897e4..9b3cc46c4 100644
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/pom.xml
+++ b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/pom.xml
@@ -27,16 +27,5 @@
true
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.mockito
- mockito-inline
- test
-
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/src/main/java/com/tencent/cloud/plugin/discovery/adapter/transformer/NacosInstanceTransformer.java b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/src/main/java/com/tencent/cloud/plugin/discovery/adapter/transformer/NacosInstanceTransformer.java
index 8fad7ba55..fbe0cc9e5 100644
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/src/main/java/com/tencent/cloud/plugin/discovery/adapter/transformer/NacosInstanceTransformer.java
+++ b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/src/main/java/com/tencent/cloud/plugin/discovery/adapter/transformer/NacosInstanceTransformer.java
@@ -22,6 +22,7 @@ import com.netflix.loadbalancer.Server;
import com.tencent.cloud.polaris.loadbalancer.transformer.InstanceTransformer;
import com.tencent.polaris.api.pojo.DefaultInstance;
+
/**
* NacosInstanceTransformer.
*
@@ -38,4 +39,5 @@ public class NacosInstanceTransformer implements InstanceTransformer {
instance.setMetadata(nacosServer.getMetadata());
}
}
+
}
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/src/test/java/com/tencent/cloud/plugin/discovery/adapter/config/NacosDiscoveryAdapterAutoConfigurationTest.java b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/src/test/java/com/tencent/cloud/plugin/discovery/adapter/config/NacosDiscoveryAdapterAutoConfigurationTest.java
index b002ae13b..9e6167828 100644
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/src/test/java/com/tencent/cloud/plugin/discovery/adapter/config/NacosDiscoveryAdapterAutoConfigurationTest.java
+++ b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-discovery-adapter-plugin/src/test/java/com/tencent/cloud/plugin/discovery/adapter/config/NacosDiscoveryAdapterAutoConfigurationTest.java
@@ -23,7 +23,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
-import org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration;
import static org.assertj.core.api.Assertions.assertThat;
@@ -35,10 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class NacosDiscoveryAdapterAutoConfigurationTest {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
- .withConfiguration(AutoConfigurations.of(
- NacosDiscoveryAdapterAutoConfiguration.class,
- LoadBalancerAutoConfiguration.class
- ));
+ .withConfiguration(AutoConfigurations.of(NacosDiscoveryAdapterAutoConfiguration.class));
@Test
public void testDefaultInitialization() {
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-fault-tolerance/pom.xml b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-fault-tolerance/pom.xml
index f22d224e7..26742c5ac 100644
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-fault-tolerance/pom.xml
+++ b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-fault-tolerance/pom.xml
@@ -14,20 +14,24 @@
Spring Cloud Starter Tencent Fault Tolerance Plugin
-
- org.springframework.cloud
- spring-cloud-context
-
-
org.springframework.boot
spring-boot-starter-aop
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
org.springframework.boot
- spring-boot-starter-test
- test
+ spring-boot-autoconfigure
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-gateway-plugin/pom.xml b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-gateway-plugin/pom.xml
index 49536e26c..64bbb5991 100644
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-gateway-plugin/pom.xml
+++ b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-gateway-plugin/pom.xml
@@ -36,17 +36,5 @@
spring-boot-starter-webflux
true
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.mockito
- mockito-inline
- test
-
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-gateway-plugin/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-gateway-plugin/src/main/resources/META-INF/additional-spring-configuration-metadata.json
deleted file mode 100644
index a54b4b3fb..000000000
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-gateway-plugin/src/main/resources/META-INF/additional-spring-configuration-metadata.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "properties": [
- {
- "name": "spring.cloud.tencent.plugin.scg.enabled",
- "type": "java.lang.Boolean",
- "defaultValue": true,
- "description": "the switch for spring cloud gateway plugin."
- },
- {
- "name": "spring.cloud.tencent.plugin.scg.staining.enabled",
- "type": "java.lang.Boolean",
- "defaultValue": false,
- "description": "the switch for spring cloud gateway staining plugin."
- },
- {
- "name": "spring.cloud.tencent.plugin.scg.staining.rule-staining.enabled",
- "type": "java.lang.Boolean",
- "defaultValue": true,
- "description": "the switch for spring cloud gateway rule staining plugin."
- },
- {
- "name": "spring.cloud.tencent.plugin.scg.staining.rule-staining.namespace",
- "type": "java.lang.String",
- "defaultValue": "default",
- "description": "The namespace used to config staining rules."
- },
- {
- "name": "spring.cloud.tencent.plugin.scg.staining.rule-staining.group",
- "type": "java.lang.String",
- "defaultValue": "${spring.application.name}",
- "description": "The group used to config staining rules."
- },
- {
- "name": "spring.cloud.tencent.plugin.scg.staining.rule-staining.fileName",
- "type": "java.lang.String",
- "defaultValue": "rule/staining.json",
- "description": "The file name used to config staining rules."
- }
- ]
-}
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-threadlocal-plugin/pom.xml b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-threadlocal-plugin/pom.xml
index 91975c141..3b4561718 100644
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-threadlocal-plugin/pom.xml
+++ b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-threadlocal-plugin/pom.xml
@@ -21,14 +21,9 @@
- org.springframework.boot
- spring-boot-starter
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
+ org.springframework
+ spring-core
+ provided
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-trace-plugin/pom.xml b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-trace-plugin/pom.xml
index 99fe4f187..d2f5b89b4 100644
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-trace-plugin/pom.xml
+++ b/spring-cloud-tencent-plugin-starters/spring-cloud-starter-tencent-trace-plugin/pom.xml
@@ -1,4 +1,4 @@
-
spring-cloud-tencent-plugin-starters
@@ -16,9 +16,5 @@
com.tencent.cloud
spring-cloud-tencent-rpc-enhancement
-
- com.tencent.polaris
- trace-otel
-
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/pom.xml b/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/pom.xml
deleted file mode 100644
index 25cce93dd..000000000
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
- spring-cloud-tencent-plugin-starters
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- spring-cloud-tencent-featureenv-plugin
- Spring Cloud Tencent Feature Environment Plugin
-
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-router
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/java/com/tencent/cloud/plugin/featureenv/FeatureEnvAutoConfiguration.java b/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/java/com/tencent/cloud/plugin/featureenv/FeatureEnvAutoConfiguration.java
deleted file mode 100644
index 866b5873d..000000000
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/java/com/tencent/cloud/plugin/featureenv/FeatureEnvAutoConfiguration.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.plugin.featureenv;
-
-import com.tencent.cloud.polaris.context.ConditionalOnPolarisEnabled;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * Auto configuration for feature env.
- * @author lepdou 2022-07-06
- */
-@Configuration
-@ConditionalOnPolarisEnabled
-@ConditionalOnProperty(value = "spring.cloud.tencent.plugin.router.feature-env.enabled", matchIfMissing = true)
-public class FeatureEnvAutoConfiguration {
-
- @Bean
- public FeatureEnvProperties featureEnvProperties() {
- return new FeatureEnvProperties();
- }
-
- @Bean
- public FeatureEnvRouterRequestInterceptor featureEnvRouterRequestInterceptor() {
- return new FeatureEnvRouterRequestInterceptor();
- }
-}
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/java/com/tencent/cloud/plugin/featureenv/FeatureEnvProperties.java b/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/java/com/tencent/cloud/plugin/featureenv/FeatureEnvProperties.java
deleted file mode 100644
index 8d49bf410..000000000
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/java/com/tencent/cloud/plugin/featureenv/FeatureEnvProperties.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.plugin.featureenv;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-/**
- * The properties for feature env.
- * @author lepdou 2022-07-12
- */
-@ConfigurationProperties("spring.cloud.tencent.plugin.router.feature-env")
-public class FeatureEnvProperties {
-
- private boolean enabled;
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-}
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/java/com/tencent/cloud/plugin/featureenv/FeatureEnvRouterRequestInterceptor.java b/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/java/com/tencent/cloud/plugin/featureenv/FeatureEnvRouterRequestInterceptor.java
deleted file mode 100644
index a3a8e7eff..000000000
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/java/com/tencent/cloud/plugin/featureenv/FeatureEnvRouterRequestInterceptor.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.plugin.featureenv;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.tencent.cloud.polaris.router.PolarisRouterContext;
-import com.tencent.cloud.polaris.router.spi.RouterRequestInterceptor;
-import com.tencent.polaris.api.pojo.RouteArgument;
-import com.tencent.polaris.api.rpc.MetadataFailoverType;
-import com.tencent.polaris.plugins.router.metadata.MetadataRouter;
-import com.tencent.polaris.router.api.rpc.ProcessRoutersRequest;
-import org.apache.commons.lang.StringUtils;
-
-/**
- * Build metadata router context for feature env scene.
- * @author lepdou 2022-07-06
- */
-public class FeatureEnvRouterRequestInterceptor implements RouterRequestInterceptor {
-
- private static final String LABEL_KEY_FEATURE_ENV_ROUTER_KEY = "system-feature-env-router-label";
- private static final String DEFAULT_FEATURE_ENV_ROUTER_LABEL = "featureenv";
- private static final String NOT_EXISTED_ENV = "NOT_EXISTED_ENV";
-
- @Override
- public void apply(ProcessRoutersRequest request, PolarisRouterContext routerContext) {
- //1. get feature env router label key
- String envLabelKey = routerContext.getLabel(LABEL_KEY_FEATURE_ENV_ROUTER_KEY);
- if (StringUtils.isBlank(envLabelKey)) {
- envLabelKey = DEFAULT_FEATURE_ENV_ROUTER_LABEL;
- }
-
- //2. get feature env router label value
- String envLabelValue = routerContext.getLabel(envLabelKey);
- if (envLabelValue == null) {
- // router to base env when not matched feature env
- envLabelValue = NOT_EXISTED_ENV;
- }
-
- //3. set env metadata to router request
- Set routeArguments = new HashSet<>(1);
- routeArguments.add(RouteArgument.buildCustom(envLabelKey, envLabelValue));
-
- request.putRouterArgument(MetadataRouter.ROUTER_TYPE_METADATA, routeArguments);
-
-
- //4. set failover type to others
- request.setMetadataFailoverType(MetadataFailoverType.METADATAFAILOVERNOTKEY);
- }
-}
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/resources/META-INF/additional-spring-configuration-metadata.json
deleted file mode 100644
index e67ca364e..000000000
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/resources/META-INF/additional-spring-configuration-metadata.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "properties": [
- {
- "name": "spring.cloud.tencent.plugin.router.feature-env.enabled",
- "type": "java.lang.Boolean",
- "defaultValue": true,
- "description": "the switch for feature env plugin."
- }
- ]
-}
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/resources/META-INF/spring.factories b/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index b61fbdfab..000000000
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,2 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
- com.tencent.cloud.plugin.featureenv.FeatureEnvAutoConfiguration
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/test/java/com/tencent/cloud/plugin/featureenv/FeatureEnvAutoConfigurationTest.java b/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/test/java/com/tencent/cloud/plugin/featureenv/FeatureEnvAutoConfigurationTest.java
deleted file mode 100644
index 81f3247ba..000000000
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/test/java/com/tencent/cloud/plugin/featureenv/FeatureEnvAutoConfigurationTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.plugin.featureenv;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import org.springframework.boot.autoconfigure.AutoConfigurations;
-import org.springframework.boot.test.context.runner.ApplicationContextRunner;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Test for {@link FeatureEnvAutoConfiguration}.
- *
- * @author Hoatian Zhang
- */
-@ExtendWith(MockitoExtension.class)
-public class FeatureEnvAutoConfigurationTest {
-
- private final ApplicationContextRunner enabledApplicationContextRunner = new ApplicationContextRunner();
- private final ApplicationContextRunner disabledApplicationContextRunner = new ApplicationContextRunner();
-
- @Test
- public void testEnabled() {
- this.enabledApplicationContextRunner.withConfiguration(AutoConfigurations.of(FeatureEnvAutoConfiguration.class))
- .run(context -> {
- assertThat(context).hasSingleBean(FeatureEnvProperties.class);
- assertThat(context).hasSingleBean(FeatureEnvRouterRequestInterceptor.class);
- });
- }
-
- @Test
- public void testDisabled() {
- this.disabledApplicationContextRunner.withConfiguration(AutoConfigurations.of(FeatureEnvAutoConfiguration.class))
- .withPropertyValues("spring.cloud.tencent.plugin.router.feature-env.enabled=false")
- .run(context -> {
- assertThat(context).doesNotHaveBean(FeatureEnvProperties.class);
- assertThat(context).doesNotHaveBean(FeatureEnvRouterRequestInterceptor.class);
- });
- }
-}
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/test/java/com/tencent/cloud/plugin/featureenv/FeatureEnvRouterRequestInterceptorTest.java b/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/test/java/com/tencent/cloud/plugin/featureenv/FeatureEnvRouterRequestInterceptorTest.java
deleted file mode 100644
index ae9683407..000000000
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/test/java/com/tencent/cloud/plugin/featureenv/FeatureEnvRouterRequestInterceptorTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making spring-cloud-tencent available.
- *
- * Copyright (C) 2021 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 com.tencent.cloud.plugin.featureenv;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.tencent.cloud.common.constant.RouterConstant;
-import com.tencent.cloud.polaris.router.PolarisRouterContext;
-import com.tencent.polaris.api.pojo.DefaultServiceInstances;
-import com.tencent.polaris.api.pojo.ServiceInstances;
-import com.tencent.polaris.api.pojo.ServiceKey;
-import com.tencent.polaris.plugins.router.metadata.MetadataRouter;
-import com.tencent.polaris.router.api.rpc.ProcessRoutersRequest;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mockito;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Test for {@link FeatureEnvRouterRequestInterceptor}.
- * @author lepdou 2022-07-12
- */
-@ExtendWith(MockitoExtension.class)
-public class FeatureEnvRouterRequestInterceptorTest {
-
- @Test
- public void testDefaultRouterKey() {
- Map labels = new HashMap<>();
- labels.put("featureenv", "blue");
- PolarisRouterContext routerContext = new PolarisRouterContext();
- routerContext.putLabels(RouterConstant.ROUTER_LABELS, labels);
-
- ProcessRoutersRequest request = new ProcessRoutersRequest();
- ServiceInstances serviceInstances = new DefaultServiceInstances(Mockito.mock(ServiceKey.class), new ArrayList<>());
- request.setDstInstances(serviceInstances);
-
- FeatureEnvRouterRequestInterceptor interceptor = new FeatureEnvRouterRequestInterceptor();
-
- interceptor.apply(request, routerContext);
-
- Map metadataRouterLabels = request.getRouterMetadata().get(MetadataRouter.ROUTER_TYPE_METADATA);
- assertThat(metadataRouterLabels.size()).isEqualTo(1);
- assertThat(metadataRouterLabels.get("featureenv")).isEqualTo("blue");
- }
-
- @Test
- public void testSpecifyRouterKey() {
- Map labels = new HashMap<>();
- labels.put("system-feature-env-router-label", "specify-env");
- labels.put("specify-env", "blue");
- PolarisRouterContext routerContext = new PolarisRouterContext();
- routerContext.putLabels(RouterConstant.ROUTER_LABELS, labels);
-
- ProcessRoutersRequest request = new ProcessRoutersRequest();
- ServiceInstances serviceInstances = new DefaultServiceInstances(Mockito.mock(ServiceKey.class), new ArrayList<>());
- request.setDstInstances(serviceInstances);
-
- FeatureEnvRouterRequestInterceptor interceptor = new FeatureEnvRouterRequestInterceptor();
-
- interceptor.apply(request, routerContext);
-
- Map metadataRouterLabels = request.getRouterMetadata().get(MetadataRouter.ROUTER_TYPE_METADATA);
- assertThat(metadataRouterLabels.size()).isEqualTo(1);
- assertThat(metadataRouterLabels.get("specify-env")).isEqualTo("blue");
- }
-
- @Test
- public void testNotExistedEnvLabel() {
- Map labels = new HashMap<>();
- labels.put("system-feature-env-router-label", "specify-env");
- PolarisRouterContext routerContext = new PolarisRouterContext();
- routerContext.putLabels(RouterConstant.ROUTER_LABELS, labels);
-
- ProcessRoutersRequest request = new ProcessRoutersRequest();
- ServiceInstances serviceInstances = new DefaultServiceInstances(Mockito.mock(ServiceKey.class), new ArrayList<>());
- request.setDstInstances(serviceInstances);
-
- FeatureEnvRouterRequestInterceptor interceptor = new FeatureEnvRouterRequestInterceptor();
-
- interceptor.apply(request, routerContext);
-
- Map metadataRouterLabels = request.getRouterMetadata().get(MetadataRouter.ROUTER_TYPE_METADATA);
- assertThat(metadataRouterLabels.size()).isEqualTo(1);
- assertThat(metadataRouterLabels.get("specify-env")).isEqualTo("NOT_EXISTED_ENV");
- }
-}
diff --git a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-lossless-plugin/pom.xml b/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-lossless-plugin/pom.xml
index 2cd286421..84c9f10b8 100644
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-lossless-plugin/pom.xml
+++ b/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-lossless-plugin/pom.xml
@@ -20,50 +20,20 @@
spring-cloud-tencent-rpc-enhancement
-
- com.tencent.polaris
- lossless-register
-
-
-
- com.tencent.polaris
- lossless-deregister
-
-
-
- com.tencent.polaris
- lossless-warmup
-
-
org.springframework.boot
spring-boot-starter-aop
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.springframework.boot
- spring-boot-starter-web
- test
-
-
-
- com.tencent.polaris
- polaris-test-mock-discovery
- test
- junit
- junit
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+ org.springframework.boot
+ spring-boot-starter
-
diff --git a/spring-cloud-tencent-polaris-context/pom.xml b/spring-cloud-tencent-polaris-context/pom.xml
index 375fe7799..ce2c0a6d4 100644
--- a/spring-cloud-tencent-polaris-context/pom.xml
+++ b/spring-cloud-tencent-polaris-context/pom.xml
@@ -21,221 +21,10 @@
-
- com.tencent.polaris
- polaris-discovery-factory
-
-
- com.tencent.polaris
- router-rule
-
-
- com.tencent.polaris
- router-nearby
-
-
- com.tencent.polaris
- router-namespace
-
-
- com.tencent.polaris
- router-metadata
-
-
- com.tencent.polaris
- router-canary
-
-
- com.tencent.polaris
- router-set
-
-
-
-
-
- com.tencent.polaris
- polaris-circuitbreaker-factory
-
-
- com.tencent.polaris
- router-rule
-
-
- com.tencent.polaris
- router-nearby
-
-
- com.tencent.polaris
- router-metadata
-
-
- com.tencent.polaris
- circuitbreaker-errrate
-
-
- com.tencent.polaris
- circuitbreaker-errcount
-
-
- com.tencent.polaris
- circuitbreaker-composite
-
-
- com.tencent.polaris
- stat-prometheus
-
-
- com.tencent.polaris
- healthchecker-http
-
-
- com.tencent.polaris
- healthchecker-tcp
-
-
- com.tencent.polaris
- healthchecker-udp
-
-
-
-
-
- com.tencent.polaris
- polaris-ratelimit-factory
-
-
- com.tencent.polaris
- router-rule
-
-
- com.tencent.polaris
- router-nearby
-
-
- com.tencent.polaris
- router-namespace
-
-
- com.tencent.polaris
- router-metadata
-
-
- com.tencent.polaris
- ratelimiter-reject
-
-
- com.tencent.polaris
- ratelimiter-unirate
-
-
- com.tencent.polaris
- stat-prometheus
-
-
-
-
-
- com.tencent.polaris
- polaris-auth-factory
-
-
-
- com.tencent.polaris
- polaris-client
-
-
-
- com.tencent.polaris
- polaris-plugin-api
-
-
-
- com.tencent.polaris
- connector-polaris-grpc
-
-
- junit
- junit
-
-
-
-
-
- com.tencent.polaris
- connector-consul
-
-
-
- com.tencent.polaris
- connector-nacos
-
-
-
- com.tencent.polaris
- connector-composite
-
-
-
- com.tencent.polaris
- registry-memory
-
-
- error_prone_annotations
- com.google.errorprone
-
-
- j2objc-annotations
- com.google.j2objc
-
-
-
-
-
- com.tencent.polaris
- flow-cache-expired
-
-
-
- com.tencent.polaris
- polaris-router-factory
-
-
-
- com.tencent.polaris
- polaris-circuitbreaker-factory
-
-
-
- com.tencent.polaris
- polaris-ratelimit-factory
-
-
-
- com.tencent.polaris
- loadbalancer-random
-
-
-
- com.tencent.polaris
- loadbalancer-ringhash
-
-
-
- com.tencent.polaris
- polaris-assembly-factory
-
-
-
- com.tencent.polaris
- event-tsf
-
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
+ org.springframework
+ spring-web
+ provided
diff --git a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/ModifyAddress.java b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/ModifyAddress.java
index 780a526c8..a2fb63e86 100644
--- a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/ModifyAddress.java
+++ b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/ModifyAddress.java
@@ -23,10 +23,9 @@ import java.util.List;
import com.tencent.cloud.common.constant.OrderConstant;
import com.tencent.cloud.common.util.AddressUtils;
import com.tencent.cloud.polaris.context.config.PolarisContextProperties;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.factory.config.ConfigurationImpl;
-import org.apache.commons.lang.StringUtils;
-
-import org.springframework.util.CollectionUtils;
/**
* Modify polaris server address.
diff --git a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContext.java b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContext.java
index 0fe48f21f..93c86eb92 100644
--- a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContext.java
+++ b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContext.java
@@ -19,9 +19,9 @@ package com.tencent.cloud.polaris.context;
import com.tencent.cloud.common.metadata.StaticMetadataManager;
import com.tencent.polaris.api.plugin.common.ValueContext;
+import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.client.api.SDKContext;
import com.tencent.polaris.specification.api.v1.traffic.manage.RoutingProto;
-import org.apache.commons.lang.StringUtils;
/**
* After all configurations are loaded, post-initialize SDKContext.
diff --git a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/PolarisContextProperties.java b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/PolarisContextProperties.java
index 4274b3083..d534c1e9b 100644
--- a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/PolarisContextProperties.java
+++ b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/PolarisContextProperties.java
@@ -26,13 +26,13 @@ import java.util.stream.Collectors;
import com.tencent.cloud.polaris.context.PolarisConfigModifier;
import com.tencent.polaris.api.config.ConfigProvider;
import com.tencent.polaris.api.config.Configuration;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.factory.ConfigAPIFactory;
import com.tencent.polaris.factory.config.ConfigurationImpl;
-import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.util.CollectionUtils;
/**
* Properties for Polaris {@link com.tencent.polaris.client.api.SDKContext}.
diff --git a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/consul/ConsulProperties.java b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/consul/ConsulProperties.java
index 7f254fde7..736d9c4a9 100644
--- a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/consul/ConsulProperties.java
+++ b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/consul/ConsulProperties.java
@@ -19,7 +19,6 @@ package com.tencent.cloud.polaris.context.config.extend.consul;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.validation.annotation.Validated;
/**
* Copy from org.springframework.cloud.consul.ConsulProperties.
@@ -27,7 +26,6 @@ import org.springframework.validation.annotation.Validated;
* @author Spencer Gibb
*/
@ConfigurationProperties(ConsulProperties.PREFIX)
-@Validated
public class ConsulProperties {
/**
diff --git a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfCoreEnvironmentPostProcessor.java b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfCoreEnvironmentPostProcessor.java
index 73c0317ef..a3261d2f6 100644
--- a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfCoreEnvironmentPostProcessor.java
+++ b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfCoreEnvironmentPostProcessor.java
@@ -123,13 +123,12 @@ public final class TsfCoreEnvironmentPostProcessor implements EnvironmentPostPro
defaultProperties.put("spring.cloud.consul.discovery.register", "true");
defaultProperties.put("spring.cloud.consul.discovery.instance-id", tsfInstanceId);
defaultProperties.put("spring.cloud.polaris.discovery.instance-id", tsfInstanceId);
- defaultProperties.put("spring.cloud.polaris.discovery.zero-protection.enabled", "true");
- defaultProperties.put("spring.cloud.polaris.discovery.zero-protection.is-need-test-connectivity", "true");
+ defaultProperties.put("spring.cloud.polaris.discovery.zero-protection.enabled",
+ environment.getProperty("spring.cloud.polaris.zero-protection.enabled", "true"));
+ defaultProperties.put("spring.cloud.polaris.discovery.zero-protection.is-need-test-connectivity",
+ environment.getProperty("spring.cloud.polaris.zero-protection.is-need-test-connectivity", "true"));
defaultProperties.put("spring.cloud.discovery.client.health-indicator.enabled", "false");
- String warmupEnabled = environment.getProperty("spring.cloud.polaris.warmup.enabled");
- if (StringUtils.isBlank(warmupEnabled)) {
- defaultProperties.put("spring.cloud.polaris.warmup.enabled", true);
- }
+ defaultProperties.put("spring.cloud.polaris.warmup.enabled", environment.getProperty("spring.cloud.polaris.warmup.enabled", "true"));
// contract
defaultProperties.put("spring.cloud.polaris.contract.enabled", environment.getProperty("tsf.swagger.enabled", "true"));
@@ -156,11 +155,14 @@ public final class TsfCoreEnvironmentPostProcessor implements EnvironmentPostPro
defaultProperties.put("spring.cloud.polaris.config.groups[0].name", "application");
defaultProperties.put("spring.cloud.polaris.config.groups[0].files[0]", tsfApplicationId + "/" + tsfGroupId + "/");
defaultProperties.put("spring.cloud.polaris.config.groups[0].files[1]", tsfNamespaceId + "/");
- defaultProperties.put("spring.cloud.polaris.config.refresh-type", "refresh_context");
+ defaultProperties.put("spring.cloud.polaris.config.refresh-type",
+ environment.getProperty("spring.cloud.polaris.config.refresh-type", "refresh_context"));
// router
- defaultProperties.put("spring.cloud.polaris.router.rule-router.fail-over", "none");
- defaultProperties.put("spring.cloud.polaris.router.namespace-router.enabled", "true");
+ defaultProperties.put("spring.cloud.polaris.router.rule-router.fail-over",
+ environment.getProperty("spring.cloud.polaris.router.rule-router.fail-over", "none"));
+ defaultProperties.put("spring.cloud.polaris.router.namespace-router.enabled",
+ environment.getProperty("spring.cloud.polaris.router.namespace-router.enabled", "true"));
}
MapPropertySource propertySource = new MapPropertySource("tsf-polaris-properties", defaultProperties);
diff --git a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfCoreProperties.java b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfCoreProperties.java
index 6b45344b8..c8dcbdd77 100644
--- a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfCoreProperties.java
+++ b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfCoreProperties.java
@@ -21,7 +21,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -31,7 +31,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
*
* @author Haotian Zhang
*/
-@ConfigurationProperties("tsf")
+@ConfigurationProperties("tsf.discovery")
public class TsfCoreProperties {
@Value("${tsf_app_id:}")
diff --git a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfInstanceMetadataProvider.java b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfInstanceMetadataProvider.java
index a7a1c54ee..677509451 100644
--- a/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfInstanceMetadataProvider.java
+++ b/spring-cloud-tencent-polaris-context/src/main/java/com/tencent/cloud/polaris/context/config/extend/tsf/TsfInstanceMetadataProvider.java
@@ -23,7 +23,6 @@ import java.util.Map;
import com.tencent.cloud.common.constant.SdkVersion;
import com.tencent.cloud.common.constant.WarmupCons;
import com.tencent.cloud.common.spi.InstanceMetadataProvider;
-import com.tencent.cloud.common.util.JacksonUtils;
import com.tencent.cloud.common.util.inet.PolarisInetUtils;
import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.metadata.core.constant.TsfMetadataConstants;
@@ -75,7 +74,6 @@ public class TsfInstanceMetadataProvider implements InstanceMetadataProvider {
tsfMetadata.put(WarmupCons.TSF_START_TIME, String.valueOf(System.currentTimeMillis()));
tsfMetadata.put(TsfMetadataConstants.TSF_SDK_VERSION, SdkVersion.get());
- tsfMetadata.put(TsfMetadataConstants.TSF_TAGS, JacksonUtils.serialize2Json(tsfCoreProperties.getTsfTags()));
String ipv4Address = PolarisInetUtils.getIpString(false);
if (StringUtils.isNotBlank(ipv4Address)) {
tsfMetadata.put(TsfMetadataConstants.TSF_ADDRESS_IPV4, ipv4Address);
diff --git a/spring-cloud-tencent-polaris-loadbalancer/pom.xml b/spring-cloud-tencent-polaris-loadbalancer/pom.xml
index 0c884bc7e..da64c25d6 100644
--- a/spring-cloud-tencent-polaris-loadbalancer/pom.xml
+++ b/spring-cloud-tencent-polaris-loadbalancer/pom.xml
@@ -14,25 +14,10 @@
Spring Cloud Tencent Polaris LoadBalancer
-
com.tencent.cloud
spring-cloud-tencent-rpc-enhancement
-
-
-
-
- com.tencent.polaris
- polaris-discovery-api
-
-
-
- com.tencent.polaris
- polaris-test-common
- test
-
-
org.springframework.cloud
@@ -40,22 +25,29 @@
- org.springframework.boot
- spring-boot-starter-test
- test
+ com.google.guava
+ guava
+ 32.1.3-jre
+
+
+ com.google.code.findbugs
+ jsr305
+
+
+ org.codehaus.mojo
+ animal-sniffer-annotations
+
+
+ com.google.errorprone
+ error_prone_annotations
+
+
- org.mockito
- mockito-inline
- test
-
-
- com.tencent.polaris
- polaris-discovery-client
+ org.springframework
+ spring-web
test
-
-
diff --git a/spring-cloud-tencent-polaris-loadbalancer/src/main/java/com/tencent/cloud/polaris/loadbalancer/PolarisLoadBalancer.java b/spring-cloud-tencent-polaris-loadbalancer/src/main/java/com/tencent/cloud/polaris/loadbalancer/PolarisLoadBalancer.java
index 946832299..15da6aec8 100644
--- a/spring-cloud-tencent-polaris-loadbalancer/src/main/java/com/tencent/cloud/polaris/loadbalancer/PolarisLoadBalancer.java
+++ b/spring-cloud-tencent-polaris-loadbalancer/src/main/java/com/tencent/cloud/polaris/loadbalancer/PolarisLoadBalancer.java
@@ -43,7 +43,8 @@ import com.tencent.polaris.api.pojo.ServiceInstances;
import com.tencent.polaris.api.pojo.ServiceKey;
import com.tencent.polaris.api.rpc.GetHealthyInstancesRequest;
import com.tencent.polaris.api.rpc.InstancesResponse;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.StringUtils;
+
import org.springframework.util.CollectionUtils;
diff --git a/spring-cloud-tencent-rpc-enhancement/pom.xml b/spring-cloud-tencent-rpc-enhancement/pom.xml
index 6f15acdf3..e25532100 100644
--- a/spring-cloud-tencent-rpc-enhancement/pom.xml
+++ b/spring-cloud-tencent-rpc-enhancement/pom.xml
@@ -21,19 +21,6 @@
-
-
- com.tencent.polaris
- stat-prometheus
-
-
- junit
- junit
-
-
-
-
-
org.springframework.boot
spring-boot-starter-aop
@@ -42,6 +29,10 @@
org.springframework.boot
spring-boot-starter-logging
+
+ org.springframework.boot
+ spring-boot-starter
+
@@ -85,30 +76,6 @@
spring-boot-starter-web
true
-
-
- com.tencent.polaris
- polaris-test-common
- test
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- io.projectreactor
- reactor-test
- test
-
-
-
- org.mockito
- mockito-inline
- test
-
diff --git a/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/plugin/DefaultEnhancedPluginRunner.java b/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/plugin/DefaultEnhancedPluginRunner.java
index bbb97b38f..b582fe20c 100644
--- a/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/plugin/DefaultEnhancedPluginRunner.java
+++ b/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/plugin/DefaultEnhancedPluginRunner.java
@@ -20,11 +20,11 @@ package com.tencent.cloud.rpc.enhancement.plugin;
import java.util.Comparator;
import java.util.List;
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Multimap;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.polaris.circuitbreak.client.exception.CallAbortedException;
import com.tencent.polaris.client.api.SDKContext;
+import shade.polaris.com.google.common.collect.ArrayListMultimap;
+import shade.polaris.com.google.common.collect.Multimap;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;
diff --git a/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/plugin/PolarisEnhancedPluginUtils.java b/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/plugin/PolarisEnhancedPluginUtils.java
index 1b0451fcf..cc3429745 100644
--- a/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/plugin/PolarisEnhancedPluginUtils.java
+++ b/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/plugin/PolarisEnhancedPluginUtils.java
@@ -47,7 +47,7 @@ import com.tencent.polaris.api.pojo.RetStatus;
import com.tencent.polaris.api.pojo.ServiceKey;
import com.tencent.polaris.api.rpc.ServiceCallResult;
import com.tencent.polaris.api.utils.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/stat/config/PolarisStatProperties.java b/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/stat/config/PolarisStatProperties.java
index d871b0d7f..8e917ca81 100644
--- a/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/stat/config/PolarisStatProperties.java
+++ b/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/stat/config/PolarisStatProperties.java
@@ -31,7 +31,7 @@ public class PolarisStatProperties {
/**
* If state reporter enabled.
*/
- private boolean enabled = true;
+ private boolean enabled = false;
/**
* Path for prometheus to pull.
diff --git a/spring-cloud-tencent-rpc-enhancement/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-tencent-rpc-enhancement/src/main/resources/META-INF/additional-spring-configuration-metadata.json
index da7f0e8f6..e0af74e67 100644
--- a/spring-cloud-tencent-rpc-enhancement/src/main/resources/META-INF/additional-spring-configuration-metadata.json
+++ b/spring-cloud-tencent-rpc-enhancement/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -33,7 +33,7 @@
{
"name": "spring.cloud.polaris.stat.enabled",
"type": "java.lang.Boolean",
- "defaultValue": true,
+ "defaultValue": false,
"description": "Enable polaris stat reporter or not."
},
{