From 44b7638b4b84af64387e969b63c95707c63a87c2 Mon Sep 17 00:00:00 2001 From: fishtailfu Date: Wed, 15 Jul 2026 20:28:39 +0800 Subject: [PATCH] fix(quickstart-gateway-service): fix route failure caused by Spring Cloud Gateway 5.x property prefix change Spring Cloud Gateway 5.0.1 (webflux) renamed the configuration prefix from spring.cloud.gateway.* to spring.cloud.gateway.server.webflux.*, causing the discovery.locator and routes configuration to be ignored, so the gateway could not forward requests (returned 404). --- .../src/main/resources/application.yml | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) 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 9550370c0..1dfdc4ba7 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,8 +1,8 @@ server: port: 48081 spring: -# profiles: -# active: context + # profiles: + # active: context application: name: QuickStartGatewayService config: @@ -33,31 +33,33 @@ spring: stat: enabled: true gateway: - discovery: - locator: - enabled: true - 'predicates[0]': - name: Path - args: - patterns: '''/'' + serviceId + ''/**''' - 'filters[0]': - name: RewritePath - args: - regexp: '''/'' + serviceId + ''/(?.*)''' - replacement: '''/$\{remaining}''' - routes: - - id: QuickstartCallerService - uri: lb://QuickstartCallerService - predicates: - - Path=/QuickstartCallerService/** - filters: - - StripPrefix=1 - - id: QuickstartCalleeService - uri: lb://QuickstartCalleeService - predicates: - - Path=/QuickstartCalleeService/** - filters: - - StripPrefix=1 + server: + webflux: + discovery: + locator: + enabled: true + 'predicates[0]': + name: Path + args: + patterns: '''/'' + serviceId + ''/**''' + 'filters[0]': + name: RewritePath + args: + regexp: '''/'' + serviceId + ''/(?.*)''' + replacement: '''/$\{remaining}''' + routes: + - id: QuickstartCallerService + uri: lb://QuickstartCallerService + predicates: + - Path=/QuickstartCallerService/** + filters: + - StripPrefix=1 + - id: QuickstartCalleeService + uri: lb://QuickstartCalleeService + predicates: + - Path=/QuickstartCalleeService/** + filters: + - StripPrefix=1 logging: file: name: /sct-demo-logs/${spring.application.name}/root.log