diff --git a/CHANGELOG.md b/CHANGELOG.md
index 75548fb33e..ec505c08cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,3 +5,4 @@
- [feat:support polaris event.](https://github.com/Tencent/spring-cloud-tencent/pull/1523)
- [feat:support circuit breaker metrics reporting.](https://github.com/Tencent/spring-cloud-tencent/pull/1524)
- [feat: support gateway context, feign eager-load support default value.](https://github.com/Tencent/spring-cloud-tencent/pull/1525)
+- [feat:use polaris-all for shading third-party dependencies.](https://github.com/Tencent/spring-cloud-tencent/pull/1526)
diff --git a/pom.xml b/pom.xml
index 872794e9be..de645601b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,6 +104,8 @@
0.8.12
1.3.0
+ 3.5.1
+ 3.4.0
true
@@ -152,6 +154,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
+
+
+
@@ -165,6 +199,11 @@
maven-shade-plugin
${maven-shade-plugin.version}
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+ ${maven-clean-plugin.version}
+
@@ -172,6 +211,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 b4c07bf58d..c8a70ee68f 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 119ddc843f..31e7028533 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
-
@@ -40,35 +39,11 @@
true
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
org.springframework.cloud
spring-cloud-starter-loadbalancer
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 d4d0da06a6..f9e91b0e60 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
@@ -23,11 +23,11 @@
import java.util.Map;
import com.tencent.cloud.common.constant.MetadataConstant;
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import jakarta.servlet.http.HttpServletRequest;
-import org.apache.commons.lang.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 30f71ea2e5..8bc34cff0a 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.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.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 0f68dc23df..d94a28e709 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 @@
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.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 5f56e36867..64e8b7ede3 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 @@
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.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 8713f8a5b3..4b3109a65e 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 @@
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.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 c3fe3df236..cd5f604fc4 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 0ee8011224..9befa1ade5 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
@@ -38,68 +44,6 @@
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
@@ -111,35 +55,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 35f9c7cd3e..98ddb98c0f 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.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.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 95c34a578c..81c3bf7b7d 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.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.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 767978d15c..81503e1442 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 @@
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.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 4e7c6d46a8..8e71e5f476 100644
--- a/spring-cloud-starter-tencent-polaris-config/pom.xml
+++ b/spring-cloud-starter-tencent-polaris-config/pom.xml
@@ -27,64 +27,10 @@
-
- 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
-
-
-
-
-
-
-
- org.springframework.cloud
- spring-cloud-context
-
-
- spring-security-crypto
- org.springframework.security
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
+ org.springframework
+ spring-web
+ true
@@ -98,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 d0f696ca60..efa425b9df 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.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;
@@ -139,8 +139,15 @@ private List resolveConfigAddressFromPolarisAddress(String polarisAddres
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 3c8b1bf4f5..0a3f5d9e8f 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.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.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 PolarisConfigFileLocator(PolarisConfigProperties polarisConfigProperties,
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 PropertySource> locate(Environment environment) {
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 @@ private void initInternalConfigFiles(CompositePropertySource compositePropertySo
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 @@ private List getInternalConfigFiles() {
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 @@ else if (ArrayUtils.isNotEmpty(defaultProfiles)) {
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 @@ private void buildInternalApplicationConfigFiles(List intern
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"));
@@ -219,11 +272,11 @@ void initTsfConfigGroups(CompositePropertySource compositePropertySource) {
}
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 @@ private void initCustomPolarisConfigFiles(CompositePropertySource compositePrope
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 @@ private void initCustomPolarisConfigFiles(CompositePropertySource compositePrope
}
}
}
-
- 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/PolarisConfigFilePuller.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFilePuller.java
index 3900c3e1bd..a1e05f7ccf 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFilePuller.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFilePuller.java
@@ -28,17 +28,16 @@
import com.tencent.cloud.polaris.config.configdata.PolarisConfigDataLoader;
import com.tencent.cloud.polaris.config.enums.ConfigFileFormat;
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.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.DefaultConfigFileMetadata;
-import org.apache.commons.lang.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.CompositePropertySource;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
/**
* PolarisConfigFilePuller pull configFile from Polaris.
@@ -113,11 +112,11 @@ public void initCustomPolarisConfigFiles(CompositePropertySource compositeProper
public void initCustomPolarisConfigFile(CompositePropertySource compositePropertySource,
ConfigFileGroup configFileGroup) {
String groupNamespace = configFileGroup.getNamespace();
- if (!StringUtils.hasText(groupNamespace)) {
+ if (StringUtils.isBlank(groupNamespace)) {
groupNamespace = polarisContextProperties.getNamespace();
}
String group = configFileGroup.getName();
- if (!StringUtils.hasText(group)) {
+ if (StringUtils.isBlank(group)) {
throw new IllegalArgumentException("polaris config group name cannot be empty.");
}
List files = configFileGroup.getFiles();
@@ -160,7 +159,7 @@ else if (ConfigFileFormat.isPropertyFile(fileName)) {
private List getInternalConfigFiles(
String[] activeProfiles, String[] defaultProfiles, String serviceName) {
String namespace = polarisContextProperties.getNamespace();
- if (StringUtils.hasText(polarisContextProperties.getService())) {
+ if (StringUtils.isNotBlank(polarisContextProperties.getService())) {
serviceName = polarisContextProperties.getService();
}
// priority: application-${profile} > application > boostrap-${profile} > boostrap
@@ -170,10 +169,10 @@ private List getInternalConfigFiles(
private List getInternalConfigFiles(
String[] activeProfiles, String[] defaultProfiles, String namespace, String serviceName) {
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));
}
@@ -189,7 +188,7 @@ else if (ArrayUtils.isNotEmpty(defaultProfiles)) {
private void buildInternalApplicationConfigFiles(
List internalConfigFiles, String namespace, String serviceName, List profiles) {
for (String profile : profiles) {
- if (!StringUtils.hasText(profile)) {
+ if (StringUtils.isBlank(profile)) {
continue;
}
internalConfigFiles.add(new DefaultConfigFileMetadata(namespace, serviceName, "application-" + profile + ".properties"));
@@ -205,7 +204,7 @@ private void buildInternalApplicationConfigFiles(
private void buildInternalBootstrapConfigFiles(
List internalConfigFiles, String namespace, String serviceName, List profiles) {
for (String profile : profiles) {
- if (!StringUtils.hasText(profile)) {
+ if (StringUtils.isBlank(profile)) {
continue;
}
internalConfigFiles.add(new DefaultConfigFileMetadata(namespace, serviceName, "bootstrap-" + profile + ".properties"));
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 5e66182f07..d37604e8d0 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.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.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 @@
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 16c3d42bfe..8a1fbb1170 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 boolean isAsync() {
}
};
- 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 9da4bbe6fb..b1c2dd350e 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.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 void onApplicationEvent(@NonNull ApplicationEvent event) {
*/
@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 6f66712b87..519ca7a0e9 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 @@ static void initialize(Map ret) {
* @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 static void addChangeListener(@NonNull ConfigChangeListener listener,
@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 static void fireConfigChange(Set changedKeys, Map 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 @@ private static boolean isConfigChangeListenerInterested(ConfigChangeListener lis
* @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 d925d7cfe2..7543a837d5 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.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.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 SpringValueProcessor(PlaceholderHelper placeholderHelper,
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 Object postProcessBeforeInitialization(Object bean, @NonNull String beanN
return bean;
}
-
@Override
protected void processField(Object bean, String beanName, Field field, boolean isRefreshScope) {
// register @Value on field
@@ -169,7 +195,8 @@ private void processMethodRefreshScope(Object bean, Method method) {
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());
}
@@ -183,7 +210,8 @@ private void processMethodRefreshScope(Object bean, Method method) {
continue;
}
// field class with @ConfigurationProperties
- ConfigurationProperties configurationProperties = field.getType().getAnnotation(ConfigurationProperties.class);
+ ConfigurationProperties configurationProperties = field.getType()
+ .getAnnotation(ConfigurationProperties.class);
parseConfigurationPropertiesKeys(configurationProperties, field.getType());
}
}
@@ -241,33 +269,6 @@ else if (isCollection(field.getType())) {
}
}
- /**
- * 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 77ed0629fe..6da5797bab 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 @@ private Object evaluateBeanDefinitionString(ConfigurableBeanFactory beanFactory,
*
*/
public Set extractPlaceholderKeys(String propertyString) {
- Set placeholderKeys = Sets.newHashSet();
+ Set placeholderKeys = new HashSet<>();
if (!isPlaceholder(propertyString)) {
return placeholderKeys;
@@ -128,7 +127,7 @@ public Set extractPlaceholderKeys(String propertyString) {
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 Set extractPlaceholderKeys(String propertyString) {
// 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 Set extractPlaceholderKeys(String propertyString) {
}
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 3ac250960f..a2f501d826 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.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 8d0c223768..b4ec016c85 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 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;
@@ -51,6 +52,7 @@ public TsfConsulConfigRefreshEventListener polarisAdaptorTsfConsulRefreshEventLi
*/
@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 3e8e5fb094..1cd98ce117 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.config.enums.RefreshType;
@@ -188,7 +188,10 @@ public void testGetCustomFiles() {
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/adapter/PolarisConfigFilePullerTest.java b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFilePullerTest.java
index 29df60c464..98bae3a238 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFilePullerTest.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/adapter/PolarisConfigFilePullerTest.java
@@ -22,7 +22,6 @@
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.context.config.PolarisContextProperties;
import com.tencent.polaris.configuration.api.core.ConfigFileService;
@@ -149,7 +148,10 @@ public void testPullCustomConfigFilesWithProfile() {
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);
// file1.properties
diff --git a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/configdata/PolarisConfigDataLoaderTest.java b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/configdata/PolarisConfigDataLoaderTest.java
index 969d3361ab..b9d4179c29 100644
--- a/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/configdata/PolarisConfigDataLoaderTest.java
+++ b/spring-cloud-starter-tencent-polaris-config/src/test/java/com/tencent/cloud/polaris/config/configdata/PolarisConfigDataLoaderTest.java
@@ -22,7 +22,6 @@
import java.util.List;
import java.util.Map;
-import com.google.common.collect.Lists;
import com.tencent.cloud.polaris.config.adapter.MockedConfigKVFile;
import com.tencent.cloud.polaris.config.config.PolarisConfigProperties;
import com.tencent.cloud.polaris.context.PolarisSDKContextManager;
@@ -109,7 +108,7 @@ public void loadConfigDataInternalConfigFilesTest() {
when(polarisConfigProperties.getGroups()).thenReturn(null);
when(polarisConfigProperties.isInternalEnabled()).thenReturn(true);
- when(profiles.getActive()).thenReturn(Lists.newArrayList());
+ when(profiles.getActive()).thenReturn(new ArrayList<>());
PolarisConfigDataLoader polarisConfigDataLoader = new PolarisConfigDataLoader(new DeferredLogs());
if (INTERNAL_CONFIG_FILES_LOADED.get()) {
@@ -244,7 +243,7 @@ public void loadConfigDataCustomConfigFilesTestWithProfile() {
when(polarisConfigProperties.getGroups()).thenReturn(null);
when(polarisConfigProperties.isInternalEnabled()).thenReturn(true);
- when(profiles.getActive()).thenReturn(Lists.newArrayList());
+ when(profiles.getActive()).thenReturn(new ArrayList<>());
// file1.properties
Map file1Map = new HashMap<>();
@@ -260,7 +259,7 @@ public void loadConfigDataCustomConfigFilesTestWithProfile() {
when(polarisContextProperties.getService()).thenReturn(testServiceName);
when(polarisConfigProperties.getGroups()).thenReturn(null);
- when(profiles.getActive()).thenReturn(Lists.newArrayList());
+ when(profiles.getActive()).thenReturn(new ArrayList<>());
PolarisConfigDataLoader polarisConfigDataLoader = new PolarisConfigDataLoader(new DeferredLogs());
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 a5abe85e71..45d62a4f46 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 void testPolarisConfigEndpoint() {
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 77ce8e8922..0871fc4b86 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 void test() throws InterruptedException {
//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 316caaf5e8..30f33c651e 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-starter-webmvc-ui
+
+
+ org.springframework
+ spring-webmvc
+
+
+ org.springframework
+ spring-web
+
+
org.springdoc
springdoc-openapi-starter-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 66e2e01bb9..3e24086369 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.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.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 0086854c9a..534e5164b7 100644
--- a/spring-cloud-starter-tencent-polaris-discovery/pom.xml
+++ b/spring-cloud-starter-tencent-polaris-discovery/pom.xml
@@ -33,29 +33,11 @@
-
- com.tencent.polaris
- polaris-test-common
- test
-
-
com.tencent.polaris
connector-nacos
test
-
-
- com.tencent.polaris
- polaris-test-mock-discovery
- test
-
-
- junit
- junit
-
-
-
@@ -82,12 +64,6 @@
true
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
org.springframework.boot
spring-boot-actuator
@@ -99,22 +75,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 78129c4bcb..0382830424 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 6ffdbe52cc..bc0d68dcc5 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 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;
@@ -40,18 +38,9 @@
*/
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 ce54ded7db..cd1d4dbb03 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.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.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 ff389d675b..2ace3fb287 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.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 5e1c76eb1b..7a6e4728bc 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 void modify(ConfigurationImpl configuration) {
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 cd9e721ab0..00eeee5b04 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 static void setCheck(AutoServiceRegistrationProperties autoServiceRegistr
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 acb3670fa7..6e35a25832 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,17 +17,14 @@
package com.tencent.cloud.polaris.extend.consul;
-import jakarta.validation.constraints.DecimalMax;
-import jakarta.validation.constraints.DecimalMin;
-import jakarta.validation.constraints.Min;
-import jakarta.validation.constraints.NotNull;
-import org.joda.time.Period;
+import java.time.Duration;
+
+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.
@@ -37,7 +34,6 @@
* @author Chris Bono
*/
@ConfigurationProperties(prefix = "spring.cloud.consul.discovery.heartbeat")
-@Validated
public class ConsulHeartbeatProperties {
private static final Logger LOGGER = LoggerFactory.getLogger(ConsulHeartbeatProperties.class);
@@ -45,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;
}
@@ -81,27 +73,39 @@ public void setEnabled(boolean enabled) {
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 21b2263219..a02b00126c 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 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 f8b93b9b1e..1738f2d69c 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.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 71de4be33b..c6816a0f58 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.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 30252fd0cb..b1374fe568 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,15 +17,11 @@
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 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 jakarta.servlet.ServletContext;
import org.springframework.beans.factory.ObjectProvider;
@@ -52,14 +48,11 @@ public void customize(PolarisRegistration registration) {
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 0000000000..4290552b91
--- /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 b962cb814d..c4e1b2090b 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
@@ -93,12 +32,6 @@
true
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
org.springframework.boot
spring-boot-actuator
@@ -110,23 +43,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-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 29deec0669..8413566ee8 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.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.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 8a9f0e583a..a98c4f7f7c 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.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 dded4fc1d6..0738a56a21 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 @@
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.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 6e9fa39aa8..20d9b391f2 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
@@ -26,9 +26,6 @@
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;
@@ -47,6 +44,9 @@
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.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-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 09db21ba40..9a47cf1827 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
@@ -25,9 +25,6 @@
import java.nio.charset.StandardCharsets;
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.metadata.MetadataContext;
import com.tencent.cloud.polaris.context.ServiceRuleManager;
@@ -43,6 +40,9 @@
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 e97f4d8644..a6f94a96d8 100644
--- a/spring-cloud-starter-tencent-polaris-router/pom.xml
+++ b/spring-cloud-starter-tencent-polaris-router/pom.xml
@@ -15,41 +15,12 @@
-
- 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
@@ -87,30 +58,6 @@
spring-boot-actuator-autoconfigure
true
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.mockito
- mockito-inline
- test
-
-
-
- org.mockito
- mockito-core
- test
-
-
-
- net.bytebuddy
- byte-buddy
- test
-
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 b24595f203..0056efff35 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.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 6ff60d98d1..38de4a7a39 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.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 370cbf5199..1f1275d459 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
@@ -71,7 +71,7 @@ public RuleBasedRouterRequestInterceptor ruleBasedRouterRequestInterceptor(Polar
}
@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 72e0dc0d3f..a37c755077 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.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 8facbc8a83..73a39ceb7b 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 void testGetLabelByKeys() {
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 3c103e3acf..8c3d89f584 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,52 +32,29 @@
- org.springframework.boot
- spring-boot-autoconfigure
-
-
-
- org.springframework.boot
- spring-boot-configuration-processor
-
-
-
- org.springframework.boot
- spring-boot-starter-json
-
-
-
- org.springframework.boot
- spring-boot-starter-validation
+ org.springframework.cloud
+ spring-cloud-context
- tomcat-embed-el
- org.apache.tomcat.embed
+ spring-security-crypto
+ org.springframework.security
org.springframework.cloud
- spring-cloud-starter
-
-
- spring-security-rsa
- org.springframework.security
-
-
+ 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
@@ -90,11 +63,6 @@
true
-
- com.google.code.gson
- gson
-
-
org.springframework.cloud
spring-cloud-starter-openfeign
@@ -113,35 +81,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 55473bfd88..dd5e240acd 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.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 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 @@ private static MetadataContext createMetadataManager() {
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 static void init(Map dynamicTransitiveMetadata, Map {
// 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 static void init(Map dynamicTransitiveMetadata, Map 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 7ba43dddf1..03d1f0371c 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 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/PolarisServiceInstance.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/pojo/PolarisServiceInstance.java
index 760a3f3b73..4c2248263f 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 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 bb70728700..47598850af 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 @@
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 156069dc0e..854f22a416 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.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 6f6f9de22a..9204c0c321 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.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 static boolean get(String path, Map headers) {
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 static boolean get(String path, Map headers) {
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/expresstion/ExpressionLabelUtils.java b/spring-cloud-tencent-commons/src/main/java/com/tencent/cloud/common/util/expresstion/ExpressionLabelUtils.java
index ce5aefa581..3726d8d02f 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.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 eebb996580..8fd5a271f3 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 5fabcd2add..a6c233ff45 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 ee12360c40..f438bd4954 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
@@ -22,12 +22,10 @@
import java.util.Map;
import java.util.Set;
-
+import com.tencent.polaris.api.utils.CollectionUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
-import org.apache.commons.lang.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 f39764c14f..6c57b0ed14 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.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 b0348613ee..eec2374daa 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.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 int hashCode() {
return (key == null ? 0 : key.hashCode()) + (flags == null ? 0 : flags.hashCode());
}
-
@Override
public String toString() {
return "Tag{" +
@@ -140,4 +91,38 @@ public String toString() {
", 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 7ec3c91a40..8db0a1fd7b 100644
--- a/spring-cloud-tencent-coverage/pom.xml
+++ b/spring-cloud-tencent-coverage/pom.xml
@@ -79,11 +79,6 @@
spring-cloud-starter-tencent-discovery-adapter-plugin
-
- com.tencent.cloud
- spring-cloud-tencent-featureenv-plugin
-
-
com.tencent.cloud
spring-cloud-starter-tencent-gateway-plugin
diff --git a/spring-cloud-tencent-dependencies/pom.xml b/spring-cloud-tencent-dependencies/pom.xml
index bfb5d7003b..27743a2bab 100644
--- a/spring-cloud-tencent-dependencies/pom.xml
+++ b/spring-cloud-tencent-dependencies/pom.xml
@@ -77,14 +77,10 @@
2.0.1.0-SNAPSHOT
- 32.0.1-jre
2.2.0
4.9.0
1.12.19
- 2.15.3
- 3.21.7
- 3.4.0
- 2.9.9
+ 2.15.4
2.0.2
@@ -181,12 +177,6 @@
${revision}
-
- com.tencent.cloud
- spring-cloud-tencent-featureenv-plugin
- ${revision}
-
-
com.tencent.cloud
spring-cloud-starter-tencent-gateway-plugin
@@ -224,26 +214,6 @@
-
- com.google.guava
- guava
- ${guava.version}
-
-
- jsr305
- com.google.code.findbugs
-
-
- animal-sniffer-annotations
- org.codehaus.mojo
-
-
- error_prone_annotations
- com.google.errorprone
-
-
-
-
org.springdoc
springdoc-openapi-starter-webmvc-ui
@@ -256,30 +226,12 @@
${springdoc.version}
-
- com.google.protobuf
- protobuf-java
- ${protobuf-java.version}
-
-
net.bytebuddy
byte-buddy
${byte-buddy.version}
-
- com.squareup.okio
- okio
- ${okio.version}
-
-
-
- joda-time
- joda-time
- ${joda-time.version}
-
-
org.mockito
mockito-inline
@@ -303,11 +255,34 @@
- polaris-dependencies
+ polaris-all
com.tencent.polaris
${polaris.version}
- pom
- import
+
+
+
+ polaris-threadlocal
+ com.tencent.polaris
+ ${polaris.version}
+
+
+
+ com.tencent.polaris
+ connector-nacos
+ ${polaris.version}
+
+
+
+ com.tencent.polaris
+ polaris-test-common
+ ${polaris.version}
+ test
+
+
+ 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 444d1513c0..d5b81019f3 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 3d53dd2278..e5d0018f38 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 1a35800d08..0000000000
--- 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:80/
- - 账号: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:80/#/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 c902fcf0d6..0000000000
--- 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:80/
- - 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:80/#/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 4b1c3d1e45..0000000000
--- 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 83849c940b..0000000000
--- 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 7eb6d43e41..0000000000
--- 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 4ee62a4782..0000000000
--- 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 38e365cf5e..0000000000
--- 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 bdc7b90e6a..0000000000
--- 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 b0226c362e..0000000000
--- 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 7370da0b7c..0000000000
--- 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 f97f3cc87a..0000000000
--- 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 8b0ed00248..0000000000
--- 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 0abc4bceee..0000000000
--- 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 9d6d99351c..0000000000
--- 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 d12e18cb89..0000000000
--- 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 dc245a3799..0000000000
--- 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 c161112bb6..0000000000
--- 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 57fa48b178..0000000000
--- 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 3d83011f1a..0000000000
--- 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 e260c06164..0000000000
--- 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 f5d64a10e4..0000000000
--- 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 873bd1394e..0000000000
--- 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 5d62092525..0000000000
--- 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 76a80726b4..0000000000
--- 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 1b40723b84..0000000000
--- 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 ddf1b53945..0000000000
--- 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 b364b109ca..0000000000
--- 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 bc2f20a6fa..0000000000
--- 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 d767659aaa..0000000000
--- 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 6a0b1a65ba..0000000000
--- 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 2803ce6bb1..0000000000
--- 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 fb4268738e..0000000000
--- 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 23bd37c7d0..0000000000
--- 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 7dd64d18ce..0000000000
--- 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 436f6d38d5..0000000000
--- 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 6937fc89f0..0000000000
--- 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 f14cbd7d6f..0000000000
--- 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 72578faf82..0000000000
--- 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 9a0b6a1233..0000000000
--- 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 9326f11e9a..0000000000
--- 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 2b8a9c8a11..0000000000
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 3f2a09a393..0000000000
--- a/spring-cloud-tencent-examples/polaris-router-featureenv-example/pom.xml
+++ /dev/null
@@ -1,39 +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
-
-
-
- org.springframework.cloud
- spring-cloud-starter-bootstrap
-
-
-
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 6f602207d4..085bb8fc12 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 3431f03d08..b54fc993cd 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 f1a48d81bd..e24c801794 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 efd0edff1b..81e3214b49 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 8eccfd4446..76f0fedcbf 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 ce65881181..65a869a811 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 0f3495e9e2..ac9097549c 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 cc72331c65..1c4860a581 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 4428cc570d..81e4e1df90 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 ca0dc43583..04f4a8314a 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 2af3215fa7..05724b1559 100644
--- a/spring-cloud-tencent-examples/tsf-example/provider-demo/pom.xml
+++ b/spring-cloud-tencent-examples/tsf-example/provider-demo/pom.xml
@@ -30,33 +30,4 @@
spring-cloud-starter-bootstrap
-
-
-
-
- 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 f898637cb6..6a2656fd73 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 List findMessages(@RequestBody
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 MessageModel getMessageDetail(@RequestParam(name = "id")
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 67ad734d84..1ba1a63220 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 650dc5bd26..83642f639e 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
@@ -20,23 +20,11 @@
spring-cloud-starter-tencent-polaris-router
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
com.alibaba.cloud
spring-cloud-starter-alibaba-nacos-discovery
2022.0.0.0
true
-
-
- 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 7abc787349..d5ac3cec75 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
@@ -19,7 +19,7 @@
import com.tencent.cloud.rpc.enhancement.transformer.InstanceTransformer;
import com.tencent.polaris.api.pojo.DefaultInstance;
-import org.apache.commons.lang.StringUtils;
+import com.tencent.polaris.api.utils.StringUtils;
import org.springframework.cloud.client.ServiceInstance;
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 6387830aae..5dabf398d7 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.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 @@
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 f22d224e76..26742c5acd 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 49536e26c0..64bbb59911 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 a54b4b3fbb..0000000000
--- 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 91975c1411..3b4561718c 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 99fe4f187e..d2f5b89b48 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 25cce93dd8..0000000000
--- 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 866b5873d4..0000000000
--- 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 8d49bf410e..0000000000
--- 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 a3a8e7eff3..0000000000
--- 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 e67ca364ee..0000000000
--- 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/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 81f3247baf..0000000000
--- 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 5e7d6686a7..0000000000
--- a/spring-cloud-tencent-plugin-starters/spring-cloud-tencent-featureenv-plugin/src/test/java/com/tencent/cloud/plugin/featureenv/FeatureEnvRouterRequestInterceptorTest.java
+++ /dev/null
@@ -1,106 +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, Hoatian Zhang
- */
-@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 2cd2864210..84c9f10b83 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 4d43b70085..ce2c0a6d4d 100644
--- a/spring-cloud-tencent-polaris-context/pom.xml
+++ b/spring-cloud-tencent-polaris-context/pom.xml
@@ -21,216 +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-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 780a526c89..a2fb63e86b 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 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 0fe48f21f9..93c86eb929 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 @@
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 4274b30836..d534c1e9b0 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 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 6986beebd0..736d9c4a90 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
@@ -17,11 +17,8 @@
package com.tencent.cloud.polaris.context.config.extend.consul;
-import jakarta.validation.constraints.NotNull;
-
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.
@@ -29,7 +26,6 @@
* @author Spencer Gibb
*/
@ConfigurationProperties(ConsulProperties.PREFIX)
-@Validated
public class ConsulProperties {
/**
@@ -38,7 +34,6 @@ public class ConsulProperties {
public static final String PREFIX = "spring.cloud.consul";
/** Consul agent hostname. Defaults to 'localhost'. */
- @NotNull
private String host = "localhost";
/**
@@ -48,7 +43,6 @@ public class ConsulProperties {
private String scheme;
/** Consul agent port. Defaults to '8500'. */
- @NotNull
private int port = 8500;
/** Is spring cloud consul enabled. */
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 484be810fd..0c9d046968 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
@@ -126,13 +126,12 @@ public void postProcessEnvironment(ConfigurableEnvironment environment, SpringAp
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"));
@@ -159,11 +158,14 @@ public void postProcessEnvironment(ConfigurableEnvironment environment, SpringAp
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 6b45344b86..c8dcbdd77b 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.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 @@
*
* @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 a7a1c54ee5..677509451b 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 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 Map getMetadata() {
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-rpc-enhancement/pom.xml b/spring-cloud-tencent-rpc-enhancement/pom.xml
index 3b9c9861b0..163689ef8f 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
+
@@ -79,24 +70,6 @@
spring-boot-starter-web
true
-
-
- 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 64538a10fa..b582fe20cb 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 @@
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;
@@ -73,6 +73,19 @@ public DefaultEnhancedPluginRunner(
}
}
+ static Registration getPolarisRegistration(List registration) {
+
+ if (CollectionUtils.isEmpty(registration)) {
+ return null;
+ }
+ for (Registration reg : registration) {
+ if ("com.tencent.cloud.polaris.registry.PolarisRegistration".equals(reg.getClass().getName())) {
+ return reg;
+ }
+ }
+ return registration.get(0);
+ }
+
/**
* run the plugin.
*
@@ -98,17 +111,4 @@ public void run(EnhancedPluginType pluginType, EnhancedPluginContext context) {
public ServiceInstance getLocalServiceInstance() {
return this.localServiceInstance;
}
-
- static Registration getPolarisRegistration(List registration) {
-
- if (CollectionUtils.isEmpty(registration)) {
- return null;
- }
- for (Registration reg : registration) {
- if ("com.tencent.cloud.polaris.registry.PolarisRegistration".equals(reg.getClass().getName())) {
- return reg;
- }
- }
- return registration.get(0);
- }
}
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 1b0451fcf5..cc34297451 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.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 d871b0d7f2..8e917ca81c 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 da7f0e8f61..e0af74e670 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."
},
{