From be5342c7bacf54c09b5c4b2aff084f9aeb9e14d5 Mon Sep 17 00:00:00 2001 From: fishtailfu Date: Mon, 19 May 2025 11:46:38 +0800 Subject: [PATCH] fix: add gateway context config example. --- CHANGELOG.md | 3 +- .../pom.xml | 6 --- .../pom.xml | 6 --- spring-cloud-tencent-commons/pom.xml | 6 +++ .../main/resources/application-context.yml | 45 ++++++++++++++----- .../src/main/resources/application.yml | 2 + spring-cloud-tencent-rpc-enhancement/pom.xml | 6 +++ 7 files changed, 51 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a920b062d..8caa5c739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,4 +14,5 @@ - [feat: support config event.](https://github.com/Tencent/spring-cloud-tencent/pull/1532) - [feat:support stat and event report with service discovery.](https://github.com/Tencent/spring-cloud-tencent/pull/1533) - [fix: update EnhancedRequestContext toString method.](https://github.com/Tencent/spring-cloud-tencent/pull/1547) -- [docs: update GitHub Actions.](https://github.com/Tencent/spring-cloud-tencent/pull/1554) \ No newline at end of file +- [docs: update GitHub Actions.](https://github.com/Tencent/spring-cloud-tencent/pull/1554) +- [fix: add gateway context config example.](https://github.com/Tencent/spring-cloud-tencent/pull/1561) \ No newline at end of file diff --git a/spring-cloud-starter-tencent-polaris-config/pom.xml b/spring-cloud-starter-tencent-polaris-config/pom.xml index 8e71e5f47..018d12f60 100644 --- a/spring-cloud-starter-tencent-polaris-config/pom.xml +++ b/spring-cloud-starter-tencent-polaris-config/pom.xml @@ -18,12 +18,6 @@ com.tencent.cloud spring-cloud-tencent-polaris-context - - - spring-security-crypto - org.springframework.security - - diff --git a/spring-cloud-starter-tencent-polaris-discovery/pom.xml b/spring-cloud-starter-tencent-polaris-discovery/pom.xml index 534e5164b..598d23b42 100644 --- a/spring-cloud-starter-tencent-polaris-discovery/pom.xml +++ b/spring-cloud-starter-tencent-polaris-discovery/pom.xml @@ -18,12 +18,6 @@ com.tencent.cloud spring-cloud-tencent-rpc-enhancement - - - spring-security-crypto - org.springframework.security - - diff --git a/spring-cloud-tencent-commons/pom.xml b/spring-cloud-tencent-commons/pom.xml index 8c3d89f58..b447abb3b 100644 --- a/spring-cloud-tencent-commons/pom.xml +++ b/spring-cloud-tencent-commons/pom.xml @@ -45,6 +45,12 @@ org.springframework.cloud spring-cloud-commons + + + spring-security-crypto + org.springframework.security + + diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/application-context.yml b/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/application-context.yml index 5b90a3e2d..eb246ea63 100644 --- a/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/application-context.yml +++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/application-context.yml @@ -3,10 +3,10 @@ spring: tencent: gateway: groups: - group-scg2p: + group-callee: predicate: apiType: ms - context: /group1 + context: /group-callee namespace: key: null position: PATH @@ -15,17 +15,42 @@ spring: position: PATH routes: - host: null - metadata: {} + metadata: { } method: GET namespace: default - path: /echo/{param} - service: provider-demo + path: /quickstart/callee/info + service: QuickstartCalleeService + group-caller: + predicate: + apiType: ms + context: /group-caller + namespace: + key: null + position: PATH + service: + key: null + position: PATH + routes: + - host: null + metadata: { } + method: GET + namespace: default + path: /quickstart/** + service: QuickstartCallerService routes: - group1: + group-callee: + filters: + - Context=group-callee + order: -1 + predicates: + - Context=group-callee + - Path=/group-callee/** + uri: lb://group-callee # do not use "_". + group-caller: filters: - - Context=group1 + - Context=group-caller order: -1 predicates: - - Context=group1 - - Path=/group1/** - uri: lb://group1 + - Context=group-caller + - Path=/group-caller/** + uri: lb://group-caller # do not use "_". diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/application.yml b/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/application.yml index dadcd07d7..9550370c0 100644 --- a/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/application.yml +++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/application.yml @@ -1,6 +1,8 @@ server: port: 48081 spring: +# profiles: +# active: context application: name: QuickStartGatewayService config: diff --git a/spring-cloud-tencent-rpc-enhancement/pom.xml b/spring-cloud-tencent-rpc-enhancement/pom.xml index 9bb55fd6f..ee85b0c71 100644 --- a/spring-cloud-tencent-rpc-enhancement/pom.xml +++ b/spring-cloud-tencent-rpc-enhancement/pom.xml @@ -39,6 +39,12 @@ org.springframework.cloud spring-cloud-loadbalancer + + + spring-security-crypto + org.springframework.security + +