From 2439086bd6abed35942f16d72f2f4dde581b263b Mon Sep 17 00:00:00 2001 From: Haotian Zhang <928016560@qq.com> Date: Fri, 9 Sep 2022 00:02:32 +0800 Subject: [PATCH] feat:optimize examples. (#577) * feat:optimize examples. * feat:optimize examples. --- CHANGELOG.md | 1 + .../annotation/SpringValueProcessor.java | 3 +- .../spring/property/PlaceholderHelper.java | 3 +- .../config/spring/property/SpringValue.java | 3 +- .../property/SpringValueDefinition.java | 3 +- .../spring/property/SpringValueRegistry.java | 3 +- .../metadata-transfer-example/README-zh.md | 48 +++++---- .../metadata-transfer-example/README.md | 55 ++++++----- .../metadata-backend/pom.xml | 93 ++++++++++-------- .../src/main/resources/bootstrap.yml | 2 +- .../metadata-frontend/pom.xml | 98 +++++++++++-------- .../src/main/resources/bootstrap.yml | 4 +- .../metadata-middle/pom.xml | 98 +++++++++++-------- .../src/main/resources/bootstrap.yml | 2 +- .../metadata-transfer-example/pom.xml | 22 ----- .../polaris-circuitbreaker-example-a/pom.xml | 61 ++++++------ .../circuitbreaker/example/ProviderB.java | 2 +- .../example/ProviderBFallback.java | 1 - .../src/main/resources/polaris.yml | 14 --- .../polaris-circuitbreaker-example-b/pom.xml | 81 ++++++++------- .../example/ServiceBController.java | 1 + .../polaris-circuitbreaker-example-b2/pom.xml | 10 +- .../example/ServiceBController.java | 1 + .../polaris-circuitbreaker-example/pom.xml | 8 -- .../config/example/ConfigController.java | 1 - .../cloud/polaris/config/example/Person.java | 1 - .../example/PersonConfigChangeListener.java | 1 - .../PolarisConfigExampleApplication.java | 1 - .../discovery-callee-service/pom.xml | 81 +++++++-------- .../callee/DiscoveryCalleeController.java | 1 - .../callee/DiscoveryCalleeService.java | 1 - .../src/main/resources/bootstrap.yml | 6 +- .../discovery-caller-service/pom.xml | 89 ++++++++--------- .../caller/DiscoveryCalleeService.java | 1 - .../DiscoveryCalleeServiceFallback.java | 1 - .../caller/DiscoveryCallerController.java | 1 - .../caller/DiscoveryCallerService.java | 1 - .../src/main/resources/bootstrap.yml | 7 +- .../callee/GatewayCalleeApplication.java | 1 - .../callee/GatewayCalleeController.java | 1 - ...on.java => GatewayCalleeApplication2.java} | 5 +- .../callee/GatewayCalleeController.java | 1 - .../example/scg/GatewayScgApplication.java | 1 - .../src/main/resources/bootstrap.yml | 24 ++--- .../service/callee/CustomLabelResolver.java | 1 - .../callee/RateLimitCalleeService.java | 1 - .../polaris-router-example/pom.xml | 32 +----- .../router-callee-service1/pom.xml | 9 +- .../example/RouterCalleeApplication1.java | 1 - .../example/RouterCalleeController.java | 1 - .../router-callee-service2/pom.xml | 9 +- .../example/RouterCalleeApplication2.java | 1 - .../example/RouterCalleeController.java | 1 - .../router-caller-service/pom.xml | 19 +++- .../CustomSpringWebRouterLabelResolver.java | 1 - .../router/example/RouterCalleeService.java | 1 - .../example/RouterCallerApplication.java | 1 - .../example/RouterCallerController.java | 1 - .../BlockingLoadBalancerClientAspect.java | 3 +- 59 files changed, 460 insertions(+), 465 deletions(-) delete mode 100644 spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/resources/polaris.yml rename spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/{GatewayCalleeApplication.java => GatewayCalleeApplication2.java} (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5451c93cf..839072e91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,3 +35,4 @@ - [feat:add spring-cloud-starter-tencent-all and quickstart examples.](https://github.com/Tencent/spring-cloud-tencent/pull/568) - [refactor:optimize project and code.](https://github.com/Tencent/spring-cloud-tencent/pull/570) - [Optimize:change default dynamic config refresh type to reflect.](https://github.com/Tencent/spring-cloud-tencent/pull/574) +- [feat:optimize examples.](https://github.com/Tencent/spring-cloud-tencent/pull/577) 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 ca966159f..26635ed44 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 @@ -48,8 +48,7 @@ import org.springframework.lang.NonNull; /** * Spring value processor of field or method which has @Value and xml config placeholders. - *
- *
+ *

* This source file was originally from: * * SpringValueProcessor 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 a2223dc78..8827fa3ed 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 @@ -31,8 +31,7 @@ import org.springframework.util.StringUtils; /** * Placeholder helper functions. - *
- *
+ *

* This source file was originally from: * * PlaceholderHelper diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValue.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValue.java index 06556d929..01b1861f8 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValue.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValue.java @@ -26,8 +26,7 @@ import org.springframework.core.MethodParameter; /** * Spring @Value method info. - *
- *
+ *

* This source file was originally from: * * SpringValue diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValueDefinition.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValueDefinition.java index a3382fd5d..fa7612fe0 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValueDefinition.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/spring/property/SpringValueDefinition.java @@ -19,8 +19,7 @@ package com.tencent.cloud.polaris.config.spring.property; /** * Spring value. - *
- *
+ *

* This source file was originally from: * * SpringValueDefinition 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 78ed172f5..473ed909e 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 @@ -36,8 +36,7 @@ import org.springframework.beans.factory.BeanFactory; /** * Spring value auto registry. - *
- *
+ *

* This source file was originally from: * * SpringValueRegistry diff --git a/spring-cloud-tencent-examples/metadata-transfer-example/README-zh.md b/spring-cloud-tencent-examples/metadata-transfer-example/README-zh.md index 764a80c38..e68cffa1e 100644 --- a/spring-cloud-tencent-examples/metadata-transfer-example/README-zh.md +++ b/spring-cloud-tencent-examples/metadata-transfer-example/README-zh.md @@ -24,9 +24,10 @@ spring: ### Maven依赖 ```xml + - com.tencent.cloud - spring-cloud-starter-tencent-metadata-transfer + com.tencent.cloud + spring-cloud-starter-tencent-metadata-transfer ``` @@ -41,11 +42,11 @@ spring: ##### IDEA启动 分别启动 + - ```spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend```的```MetadataFrontendService``` - ```spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle```的```MetadataMiddleService``` - ```spring-cloud-tencent-examples/metadata-transfer-example/metadata-backend```的```MetadataBackendService``` - ##### Maven打包启动 在```spring-cloud-tencent-examples/metadata-transfer-example```下执行 @@ -76,7 +77,7 @@ spring: # 示例:本地元数据,默认不在链路中传递 CUSTOM-METADATA-KEY-LOCAL: CUSTOM-VALUE-LOCAL # 示例:可传递元数据 - CUSTOM-METADATA-KEY-TRANSITIVE: CUSTOM-VALUE-TRANSITIVE + CUSTOM-METADATA-KEY-TRANSITIVE: CUSTOM-VALUE-TRANSITIVE-FRONTEND # 示例:一次性元数据 CUSTOM-METADATA-KEY-DISPOSABLE: CUSTOM-VALUE-DISPOSABLE-FRONTEND # 指定哪个元数据的键值将沿着链接传递 @@ -123,16 +124,15 @@ curl -L -X GET 'http://127.0.0.1:48080/metadata/service/frontend/feign/info' ```json { "frontend-transitive-metadata": { - "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE" + "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE-FRONTEND" }, "frontend-upstream-disposable-metadata": { }, "frontend-local-disposable-metadata": { "CUSTOM-METADATA-KEY-DISPOSABLE": "CUSTOM-VALUE-DISPOSABLE-FRONTEND" }, - "middle-transitive-metadata": { - "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE", + "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE-FRONTEND", "CUSTOM-METADATA-KEY-TRANSITIVE-2": "CUSTOM-VALUE-TRANSITIVE-2" }, "middle-upstream-disposable-metadata": { @@ -141,9 +141,8 @@ curl -L -X GET 'http://127.0.0.1:48080/metadata/service/frontend/feign/info' "middle-local-disposable-metadata": { "CUSTOM-METADATA-KEY-DISPOSABLE": "CUSTOM-VALUE-DISPOSABLE-MIDDLE" }, - "backend-transitive-metadata": { - "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE", + "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE-FRONTEND", "CUSTOM-METADATA-KEY-TRANSITIVE-2": "CUSTOM-VALUE-TRANSITIVE-2" }, "backend-upstream-disposable-metadata": { @@ -166,35 +165,32 @@ curl -L -X GET 'http://127.0.0.1:48080/metadata/service/frontend/feign/info' - 获取全局传递的元数据 -```java -MetadataContext context = MetadataContextHolder.get(); - Map customMetadataMap = context.getFragmentContext(MetadataContext.FRAGMENT_TRANSITIVE); - -customMetadataMap.forEach((key, value) -> { - // ... +``` +MetadataContext context=MetadataContextHolder.get(); +Map customMetadataMap=context.getFragmentContext(MetadataContext.FRAGMENT_TRANSITIVE); +customMetadataMap.forEach((key,value)->{ + // ... }); - ``` - 获取上游传递过来的一次性元数据 -```java -Map upstreamDisposableMetadatas = MetadataContextHolder.getAllDisposableMetadata(true); -upstreamDisposableMetadatas.forEach((key, value) -> { - // ... +``` +Map upstreamDisposableMetadatas=MetadataContextHolder.getAllDisposableMetadata(true); +upstreamDisposableMetadatas.forEach((key,value)->{ + // ... }); ``` - 获取本地配置的一次性元数据 -```java -Map localDisposableMetadatas = MetadataContextHolder.getAllDisposableMetadata(false); -localDisposableMetadatas.forEach((key, value) -> { - // ... +``` +Map localDisposableMetadatas=MetadataContextHolder.getAllDisposableMetadata(false); +localDisposableMetadatas.forEach((key,value)->{ + // ... }); ``` - ### Wiki参考 -查看 [Spring Cloud Tencent Metadata Transfer 使用指南](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Metadata-Transfer-%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97) . \ No newline at end of file +查看 [Spring Cloud Tencent Metadata Transfer 使用指南](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Metadata-Transfer-%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97)。 \ No newline at end of file diff --git a/spring-cloud-tencent-examples/metadata-transfer-example/README.md b/spring-cloud-tencent-examples/metadata-transfer-example/README.md index 9fc663666..5fd736ba5 100644 --- a/spring-cloud-tencent-examples/metadata-transfer-example/README.md +++ b/spring-cloud-tencent-examples/metadata-transfer-example/README.md @@ -25,9 +25,10 @@ spring: ### Maven Dependency ```xml + - com.tencent.cloud - spring-cloud-starter-tencent-metadata-transfer + com.tencent.cloud + spring-cloud-starter-tencent-metadata-transfer ``` @@ -62,10 +63,10 @@ java -jar ${app.jar} Launch application, change ${app.jar} to jar's package name. - ### Metadata Configuration -- In the ```bootstrap.yml``` configuration file of the ```spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend``` project +- In the ```bootstrap.yml``` configuration file of + the ```spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend``` project ```yaml spring: @@ -77,7 +78,7 @@ spring: # Example: intransitive CUSTOM-METADATA-KEY-LOCAL: CUSTOM-VALUE-LOCAL # Example: transitive - CUSTOM-METADATA-KEY-TRANSITIVE: CUSTOM-VALUE-TRANSITIVE + CUSTOM-METADATA-KEY-TRANSITIVE: CUSTOM-VALUE-TRANSITIVE-FRONTEND # Example: disposable CUSTOM-METADATA-KEY-DISPOSABLE: CUSTOM-VALUE-DISPOSABLE-FRONTEND # Assigned which metadata key-value will be passed along the link @@ -89,7 +90,8 @@ spring: ``` -- In the ```bootstrap.yml``` configuration file of the ```spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle``` project +- In the ```bootstrap.yml``` configuration file of + the ```spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle``` project ```yaml spring: @@ -110,7 +112,6 @@ spring: # Specify which metadata key value will be passed only once (one-step) disposable: - CUSTOM-METADATA-KEY-DISPOSABLE - ``` ### Verify @@ -126,7 +127,7 @@ Expected return rate ``` { "frontend-transitive-metadata": { - "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE" + "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE-FRONTEND" }, "frontend-upstream-disposable-metadata": { }, @@ -135,7 +136,7 @@ Expected return rate }, "middle-transitive-metadata": { - "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE", + "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE-FRONTEND", "CUSTOM-METADATA-KEY-TRANSITIVE-2": "CUSTOM-VALUE-TRANSITIVE-2" }, "middle-upstream-disposable-metadata": { @@ -146,7 +147,7 @@ Expected return rate }, "backend-transitive-metadata": { - "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE", + "CUSTOM-METADATA-KEY-TRANSITIVE": "CUSTOM-VALUE-TRANSITIVE-FRONTEND", "CUSTOM-METADATA-KEY-TRANSITIVE-2": "CUSTOM-VALUE-TRANSITIVE-2" }, "backend-upstream-disposable-metadata": { @@ -162,41 +163,43 @@ Response value description > `*` (asterisk), representing `frontend`, `middle`, `backend` in the example. - Key `*-transitive-metadata` represents all the passable (fully linked) metadata configured by default in the service. -- Key `*-upstream-disposable-metadata` indicates the one-time transmissible metadata obtained from upstream requests in the service. -- Key `*-local-disposable-metadata` indicates the one-time metadata passed downstream as configured by the current service. +- Key `*-upstream-disposable-metadata` indicates the one-time transmissible metadata obtained from upstream requests in + the service. +- Key `*-local-disposable-metadata` indicates the one-time metadata passed downstream as configured by the current + service. ### How to get the passed metadata via Api - Get the metadata passed globally -```java -MetadataContext context = MetadataContextHolder.get(); - Map customMetadataMap = context.getFragmentContext(MetadataContext.FRAGMENT_TRANSITIVE); +``` +MetadataContext context=MetadataContextHolder.get(); +Map customMetadataMap=context.getFragmentContext(MetadataContext.FRAGMENT_TRANSITIVE); -customMetadataMap.forEach((key, value) -> { +customMetadataMap.forEach((key,value)->{ // ... }); ``` - Get disposable(one-time) metadata passed from upstream -```java -Map upstreamDisposableMetadatas = MetadataContextHolder.getAllDisposableMetadata(true); -upstreamDisposableMetadatas.forEach((key, value) -> { - // ... +``` +Map upstreamDisposableMetadatas=MetadataContextHolder.getAllDisposableMetadata(true); +upstreamDisposableMetadatas.forEach((key,value)->{ + // ... }); ``` - Get disposable(one-time) metadata for local configuration -```java -Map localDisposableMetadatas = MetadataContextHolder.getAllDisposableMetadata(false); -localDisposableMetadatas.forEach((key, value) -> { - // ... +``` +Map localDisposableMetadatas=MetadataContextHolder.getAllDisposableMetadata(false); +localDisposableMetadatas.forEach((key,value)->{ + // ... }); ``` - ### Wiki Reference -See [Spring Cloud Tencent Metadata Transfer Usage Document](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Metadata-Transfer-Usage-Document) for more reference . +See [Spring Cloud Tencent Metadata Transfer Usage Document](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Metadata-Transfer-Usage-Document) +for more reference. diff --git a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-backend/pom.xml b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-backend/pom.xml index 106c2ed78..594e7fd90 100644 --- a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-backend/pom.xml +++ b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-backend/pom.xml @@ -1,51 +1,66 @@ - + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + metadata-transfer-example - com.tencent.cloud - ${revision} - ../pom.xml - - 4.0.0 + com.tencent.cloud + ${revision} + ../pom.xml + + 4.0.0 - metadata-backend - Spring Cloud Tencent Metadata Transfer Backend Service + metadata-backend + Spring Cloud Tencent Metadata Transfer Backend Service - + com.tencent.cloud spring-cloud-starter-tencent-polaris-discovery + + + com.tencent.cloud + spring-cloud-starter-tencent-metadata-transfer + + + + org.springframework.boot + spring-boot-starter-webflux + + + + org.springframework.boot + 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 - - - - - - + + + + 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/metadata-transfer-example/metadata-backend/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-backend/src/main/resources/bootstrap.yml index 4188f3cc3..b854ea342 100644 --- a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-backend/src/main/resources/bootstrap.yml +++ b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-backend/src/main/resources/bootstrap.yml @@ -17,4 +17,4 @@ management: web: exposure: include: - - polaris-metadata \ No newline at end of file + - polaris-metadata diff --git a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/pom.xml b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/pom.xml index 4b6adb14e..ce674c218 100644 --- a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/pom.xml +++ b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/pom.xml @@ -1,51 +1,71 @@ - + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + metadata-transfer-example - com.tencent.cloud - ${revision} - ../pom.xml - - 4.0.0 + com.tencent.cloud + ${revision} + ../pom.xml + + 4.0.0 - metadata-frontend - Spring Cloud Tencent Metadata Transfer Frontent Service + metadata-frontend + Spring Cloud Tencent Metadata Transfer Frontent Service - + com.tencent.cloud spring-cloud-starter-tencent-polaris-discovery + + + com.tencent.cloud + spring-cloud-starter-tencent-metadata-transfer + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.boot + 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 - - - - - - + + + + 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/metadata-transfer-example/metadata-frontend/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/src/main/resources/bootstrap.yml index 719424131..a2f71d74f 100644 --- a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/src/main/resources/bootstrap.yml +++ b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-frontend/src/main/resources/bootstrap.yml @@ -20,7 +20,7 @@ spring: # Example: intransitive CUSTOM-METADATA-KEY-LOCAL: CUSTOM-VALUE-LOCAL # Example: disposable - CUSTOM-METADATA-KEY-DISPOSABLE: CUSTOM-VALUE-DISPOSABLE + CUSTOM-METADATA-KEY-DISPOSABLE: CUSTOM-VALUE-DISPOSABLE-FRONTEND # Example: transitive CUSTOM-METADATA-KEY-TRANSITIVE: CUSTOM-VALUE-TRANSITIVE-FRONTEND # Assigned which metadata key-value will be passed along the link @@ -33,4 +33,4 @@ management: web: exposure: include: - - polaris-metadata \ No newline at end of file + - polaris-metadata diff --git a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/pom.xml b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/pom.xml index 41c4cd13f..3c0d16992 100644 --- a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/pom.xml +++ b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/pom.xml @@ -1,51 +1,71 @@ - + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + metadata-transfer-example - com.tencent.cloud - ${revision} - ../pom.xml - - 4.0.0 + com.tencent.cloud + ${revision} + ../pom.xml + + 4.0.0 - metadata-middle - Spring Cloud Tencent Metadata Transfer Middle Service + metadata-middle + Spring Cloud Tencent Metadata Transfer Middle Service - + com.tencent.cloud spring-cloud-starter-tencent-polaris-discovery + + + com.tencent.cloud + spring-cloud-starter-tencent-metadata-transfer + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.boot + 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 - - - - - - + + + + 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/metadata-transfer-example/metadata-middle/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/src/main/resources/bootstrap.yml index db78677b5..36dfc0703 100644 --- a/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/src/main/resources/bootstrap.yml +++ b/spring-cloud-tencent-examples/metadata-transfer-example/metadata-middle/src/main/resources/bootstrap.yml @@ -32,4 +32,4 @@ management: web: exposure: include: - - polaris-metadata \ No newline at end of file + - polaris-metadata diff --git a/spring-cloud-tencent-examples/metadata-transfer-example/pom.xml b/spring-cloud-tencent-examples/metadata-transfer-example/pom.xml index 2cbc55a3b..f6151cbe2 100644 --- a/spring-cloud-tencent-examples/metadata-transfer-example/pom.xml +++ b/spring-cloud-tencent-examples/metadata-transfer-example/pom.xml @@ -19,26 +19,4 @@ metadata-middle metadata-backend - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-actuator - - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - - com.tencent.cloud - spring-cloud-starter-tencent-metadata-transfer - - diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/pom.xml index 352989fbd..83843fadf 100644 --- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/pom.xml +++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/pom.xml @@ -19,6 +19,11 @@ spring-boot-starter-web + + com.tencent.cloud + spring-cloud-starter-tencent-polaris-discovery + + com.tencent.cloud spring-cloud-starter-tencent-polaris-circuitbreaker @@ -45,33 +50,33 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.0 - - - attach-sources - - jar - - - - - - + + + + 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/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderB.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderB.java index ea26ace79..f0c05217a 100644 --- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderB.java +++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderB.java @@ -30,9 +30,9 @@ public interface ProviderB { /** * Get info of service B. + * * @return info of service B */ @GetMapping("/example/service/b/info") String info(); - } diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderBFallback.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderBFallback.java index c357b1e7a..bf47d49dd 100644 --- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderBFallback.java +++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderBFallback.java @@ -31,5 +31,4 @@ public class ProviderBFallback implements ProviderB { public String info() { return "trigger the refuse for service b"; } - } diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/resources/polaris.yml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/resources/polaris.yml deleted file mode 100644 index fbe20fc8f..000000000 --- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/resources/polaris.yml +++ /dev/null @@ -1,14 +0,0 @@ -consumer: - circuitBreaker: - checkPeriod: 100ms - chain: - - errorCount - - errorRate - plugin: - errorCount: - continuousErrorThreshold: 1 - metricNumBuckets: 1 - errorRate: - errorRateThreshold: 100 - metricStatTimeWindow: 1s - requestVolumeThreshold: 1 diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/pom.xml index 22f3537b9..01dd7904a 100644 --- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/pom.xml +++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/pom.xml @@ -1,16 +1,16 @@ - - polaris-circuitbreaker-example - com.tencent.cloud - ${revision} - ../pom.xml - - 4.0.0 + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + polaris-circuitbreaker-example + com.tencent.cloud + ${revision} + ../pom.xml + + 4.0.0 - polaris-circuitbreaker-example-b + polaris-circuitbreaker-example-b Polaris Circuit Breaker Example B @@ -18,34 +18,39 @@ org.springframework.boot spring-boot-starter-webflux + + + com.tencent.cloud + spring-cloud-starter-tencent-polaris-discovery + - - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.0 - - - attach-sources - - jar - - - - - - + + + + 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/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceBController.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceBController.java index 99b8410d8..128ea5e4d 100644 --- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceBController.java +++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceBController.java @@ -33,6 +33,7 @@ public class ServiceBController { /** * Get service information. + * * @return service information */ @GetMapping("/info") diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/pom.xml index ba28b0cdd..340de2286 100644 --- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/pom.xml +++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/pom.xml @@ -1,6 +1,6 @@ - polaris-circuitbreaker-example @@ -12,12 +12,16 @@ polaris-circuitbreaker-example-b2 - org.springframework.boot spring-boot-starter-webflux + + + com.tencent.cloud + spring-cloud-starter-tencent-polaris-discovery + diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceBController.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceBController.java index 83dc45303..384167816 100644 --- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceBController.java +++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceBController.java @@ -35,6 +35,7 @@ public class ServiceBController { /** * Get service information. + * * @return service information */ @GetMapping("/info") diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml index 5876625dc..6b5daa263 100644 --- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml +++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml @@ -19,12 +19,4 @@ polaris-circuitbreaker-example-b polaris-circuitbreaker-example-b2 - - - - com.tencent.cloud - spring-cloud-starter-tencent-polaris-discovery - - - diff --git a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/ConfigController.java b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/ConfigController.java index d06a732e3..008ed33d5 100644 --- a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/ConfigController.java +++ b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/ConfigController.java @@ -51,5 +51,4 @@ public class ConfigController { public String person() { return person.toString(); } - } diff --git a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/Person.java b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/Person.java index 1d97d1fb9..1a88235de 100644 --- a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/Person.java +++ b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/Person.java @@ -54,5 +54,4 @@ public class Person { public String toString() { return "User{" + "name='" + name + '\'' + ", age=" + age + '}'; } - } diff --git a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PersonConfigChangeListener.java b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PersonConfigChangeListener.java index b0efd8b36..150e25e20 100644 --- a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PersonConfigChangeListener.java +++ b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PersonConfigChangeListener.java @@ -45,5 +45,4 @@ public final class PersonConfigChangeListener { System.out.printf("%s = %s \n", changedKey, event.getChange(changedKey)); } } - } diff --git a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PolarisConfigExampleApplication.java b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PolarisConfigExampleApplication.java index a632cf231..37544956b 100644 --- a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PolarisConfigExampleApplication.java +++ b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PolarisConfigExampleApplication.java @@ -31,5 +31,4 @@ public class PolarisConfigExampleApplication { public static void main(String[] args) { SpringApplication.run(PolarisConfigExampleApplication.class, args); } - } diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/pom.xml b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/pom.xml index 78bc477d3..7c72ba9d7 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/pom.xml +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/pom.xml @@ -1,19 +1,19 @@ - - polaris-discovery-example - com.tencent.cloud - ${revision} - ../pom.xml - - 4.0.0 + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + polaris-discovery-example + com.tencent.cloud + ${revision} + ../pom.xml + + 4.0.0 - discovery-callee-service - Polaris Discovery Callee Service + discovery-callee-service + Polaris Discovery Callee Service - + com.tencent.cloud spring-cloud-starter-tencent-polaris-discovery @@ -34,32 +34,33 @@ 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 - - - - - - + + + + + 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/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java index 408469223..7c4d82171 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java @@ -61,5 +61,4 @@ public class DiscoveryCalleeController { LOG.info("Discovery Service Callee is called and sum is {}.", value1 + value2); return value1 + value2; } - } diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeService.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeService.java index 72229bb0a..9063ae984 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeService.java +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeService.java @@ -31,5 +31,4 @@ public class DiscoveryCalleeService { public static void main(String[] args) { SpringApplication.run(DiscoveryCalleeService.class, args); } - } diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/resources/bootstrap.yml index 42dbeeb6e..9c57e95cb 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/resources/bootstrap.yml +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/resources/bootstrap.yml @@ -11,9 +11,6 @@ spring: discovery: enabled: true register: true - rpc-enhancement: - reporter: - enabled: true stat: enabled: true port: 28082 @@ -24,6 +21,9 @@ spring: metadata: content: region: shanghai + rpc-enhancement: + reporter: + enabled: true # consul: # port: 8500 # host: 127.0.0.1 diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/pom.xml b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/pom.xml index 7142ad11a..27d228ee1 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/pom.xml +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/pom.xml @@ -1,24 +1,24 @@ - - polaris-discovery-example - com.tencent.cloud - ${revision} - ../pom.xml - - 4.0.0 + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + polaris-discovery-example + com.tencent.cloud + ${revision} + ../pom.xml + + 4.0.0 - discovery-caller-service - Polaris Discovery Caller Service + discovery-caller-service + Polaris Discovery Caller Service - - 1.8 - + + 1.8 + - - + + com.tencent.cloud spring-cloud-starter-tencent-polaris-discovery @@ -42,32 +42,33 @@ spring-cloud-loadbalancer - - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.0 - - - attach-sources - - jar - - - - - - + + + + + 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/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeService.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeService.java index d2395e00d..44d20df14 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeService.java +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeService.java @@ -37,5 +37,4 @@ public interface DiscoveryCalleeService { */ @GetMapping("/discovery/service/callee/sum") int sum(@RequestParam("value1") int value1, @RequestParam("value2") int value2); - } diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceFallback.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceFallback.java index c526c9582..3b78eb3bc 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceFallback.java +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceFallback.java @@ -31,5 +31,4 @@ public class DiscoveryCalleeServiceFallback implements DiscoveryCalleeService { public int sum(int value1, int value2) { return 0; } - } diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerController.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerController.java index 2586cb892..f2ecaf5e4 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerController.java +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerController.java @@ -67,5 +67,4 @@ public class DiscoveryCallerController { public String healthCheck() { return "pk ok"; } - } diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerService.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerService.java index 55fcf01ac..5c447313c 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerService.java +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerService.java @@ -44,5 +44,4 @@ public class DiscoveryCallerService { public RestTemplate restTemplate() { return new RestTemplate(); } - } diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/resources/bootstrap.yml index eaf197281..22c330986 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/resources/bootstrap.yml +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/resources/bootstrap.yml @@ -9,6 +9,9 @@ spring: metadata: content: region: shanghai + rpc-enhancement: + reporter: + enabled: true polaris: address: grpc://183.47.111.80:8091 namespace: default @@ -22,10 +25,6 @@ spring: stat: enabled: true port: 28081 - tencent: - rpc-enhancement: - reporter: - enabled: true # pushgateway: # enabled: true # address: 127.0.0.1:9091 diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication.java b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication.java index 4e5e816bd..57d205e5e 100644 --- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication.java +++ b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication.java @@ -31,5 +31,4 @@ public class GatewayCalleeApplication { public static void main(String[] args) { SpringApplication.run(GatewayCalleeApplication.class, args); } - } diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java index 53d9fdf71..f0718b2ac 100644 --- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java +++ b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java @@ -75,5 +75,4 @@ public class GatewayCalleeController { str = ESAPI.encoder().encodeForHTML(str); return str; } - } diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication.java b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication2.java similarity index 90% rename from spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication.java rename to spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication2.java index 4e5e816bd..f6a942abd 100644 --- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication.java +++ b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication2.java @@ -26,10 +26,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; * @author Haotian Zhang */ @SpringBootApplication -public class GatewayCalleeApplication { +public class GatewayCalleeApplication2 { public static void main(String[] args) { - SpringApplication.run(GatewayCalleeApplication.class, args); + SpringApplication.run(GatewayCalleeApplication2.class, args); } - } diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java index 53d9fdf71..f0718b2ac 100644 --- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java +++ b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java @@ -75,5 +75,4 @@ public class GatewayCalleeController { str = ESAPI.encoder().encodeForHTML(str); return str; } - } diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/java/com/tencent/cloud/polaris/gateway/example/scg/GatewayScgApplication.java b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/java/com/tencent/cloud/polaris/gateway/example/scg/GatewayScgApplication.java index 6d5694d05..7bf729994 100644 --- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/java/com/tencent/cloud/polaris/gateway/example/scg/GatewayScgApplication.java +++ b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/java/com/tencent/cloud/polaris/gateway/example/scg/GatewayScgApplication.java @@ -31,5 +31,4 @@ public class GatewayScgApplication { public static void main(String[] args) { SpringApplication.run(GatewayScgApplication.class, args); } - } diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/resources/bootstrap.yml index 81a88dd67..b0890b999 100644 --- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/resources/bootstrap.yml +++ b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/resources/bootstrap.yml @@ -15,6 +15,11 @@ spring: router: feature-env: enabled: true + metadata: + content: + a: 1 + transitive: + - a polaris: address: grpc://183.47.111.80:8091 namespace: default @@ -54,15 +59,10 @@ spring: maxBackoff: '''500ms''' factor: 2 basedOnPreviousValue: false -# routes: -# - id: GatewayCalleeService -# uri: lb://GatewayCalleeService -# predicates: -# - Path=/GatewayCalleeService/** -# filters: -# - StripPrefix=1 - -logging: - level: - org.springframework.cloud.gateway: info - com.tencent.cloud.polaris: debug + routes: + - id: GatewayCalleeService + uri: lb://GatewayCalleeService + predicates: + - Path=/GatewayCalleeService/** + filters: + - StripPrefix=1 diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/CustomLabelResolver.java b/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/CustomLabelResolver.java index f441f4d2b..06ff020a2 100644 --- a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/CustomLabelResolver.java +++ b/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/CustomLabelResolver.java @@ -44,5 +44,4 @@ public class CustomLabelResolver implements PolarisRateLimiterLabelServletResolv return labels; } - } diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/RateLimitCalleeService.java b/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/RateLimitCalleeService.java index e28c34252..12a9270cc 100644 --- a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/RateLimitCalleeService.java +++ b/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/RateLimitCalleeService.java @@ -40,5 +40,4 @@ public class RateLimitCalleeService { public RestTemplate restTemplate() { return new RestTemplate(); } - } diff --git a/spring-cloud-tencent-examples/polaris-router-example/pom.xml b/spring-cloud-tencent-examples/polaris-router-example/pom.xml index 8bd99b3c1..5ae91d8bf 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/pom.xml +++ b/spring-cloud-tencent-examples/polaris-router-example/pom.xml @@ -1,6 +1,6 @@ - spring-cloud-tencent-examples @@ -18,32 +18,4 @@ router-callee-service2 router-caller-service - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-actuator - - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - - org.springframework.boot - spring-boot-actuator - - - - org.springframework.boot - spring-boot-actuator-autoconfigure - - - diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/pom.xml b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/pom.xml index bbf3bdb93..b18c63f42 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/pom.xml +++ b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/pom.xml @@ -1,6 +1,6 @@ - polaris-router-example @@ -18,6 +18,11 @@ spring-cloud-starter-tencent-polaris-discovery + + org.springframework.boot + spring-boot-starter-web + + org.owasp.esapi esapi diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication1.java b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication1.java index 6b481e472..9c36234c4 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication1.java +++ b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication1.java @@ -32,5 +32,4 @@ public class RouterCalleeApplication1 { public static void main(String[] args) { SpringApplication.run(RouterCalleeApplication1.class, args); } - } diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java index f42cd969d..6693cf08e 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java +++ b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java @@ -59,5 +59,4 @@ public class RouterCalleeController { u.setAge(user.getAge()); return u; } - } diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/pom.xml b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/pom.xml index 2397f4481..1f33825f0 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/pom.xml +++ b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/pom.xml @@ -1,6 +1,6 @@ - polaris-router-example @@ -18,6 +18,11 @@ spring-cloud-starter-tencent-polaris-discovery + + org.springframework.boot + spring-boot-starter-webflux + + org.owasp.esapi esapi diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication2.java b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication2.java index 9664f46d3..076a002f0 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication2.java +++ b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication2.java @@ -32,5 +32,4 @@ public class RouterCalleeApplication2 { public static void main(String[] args) { SpringApplication.run(RouterCalleeApplication2.class, args); } - } diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java index 6d6915b7f..6346cd606 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java +++ b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java @@ -60,5 +60,4 @@ public class RouterCalleeController { u.setAge(user.getAge()); return u; } - } diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/pom.xml b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/pom.xml index fbdbf7081..574fea7a1 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/pom.xml +++ b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/pom.xml @@ -1,6 +1,6 @@ - polaris-router-example @@ -23,6 +23,21 @@ spring-cloud-starter-tencent-polaris-router + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + com.google.code.gson gson diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/CustomSpringWebRouterLabelResolver.java b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/CustomSpringWebRouterLabelResolver.java index 44570366d..c0a84bf5f 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/CustomSpringWebRouterLabelResolver.java +++ b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/CustomSpringWebRouterLabelResolver.java @@ -48,5 +48,4 @@ public class CustomSpringWebRouterLabelResolver implements SpringWebRouterLabelR labels.put("user", user.getName()); return labels; } - } diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeService.java b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeService.java index 7f1f1db39..d8f7df0ff 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeService.java +++ b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeService.java @@ -33,5 +33,4 @@ public interface RouterCalleeService { @PostMapping("/router/service/callee/info") String info(@RequestParam("name") String name, @RequestBody User user); - } diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerApplication.java b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerApplication.java index 824a1226f..a3b05e6fd 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerApplication.java +++ b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerApplication.java @@ -45,5 +45,4 @@ public class RouterCallerApplication { public RestTemplate restTemplate() { return new RestTemplate(); } - } diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerController.java b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerController.java index 866069d24..f296393a0 100644 --- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerController.java +++ b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerController.java @@ -73,5 +73,4 @@ public class RouterCallerController { public String healthCheck() { return "pk ok"; } - } diff --git a/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/resttemplate/BlockingLoadBalancerClientAspect.java b/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/resttemplate/BlockingLoadBalancerClientAspect.java index 4012ec1a9..418ce4846 100644 --- a/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/resttemplate/BlockingLoadBalancerClientAspect.java +++ b/spring-cloud-tencent-rpc-enhancement/src/main/java/com/tencent/cloud/rpc/enhancement/resttemplate/BlockingLoadBalancerClientAspect.java @@ -23,7 +23,8 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; /** - * Intercept for LoadBalancerClient, put host&port to thread local. + * Intercept for BlockingLoadBalancerClient, put host and port to thread local. + * * @author lepdou 2022-09-05 */ @Aspect