From 2ddc1815017fd1b98df8adc0bac02a5c98a427bf Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 08:17:41 +0530 Subject: [PATCH] Add cloud-2026-upgrade: step-by-step upgrade of the shop to Spring Boot 4.2.0 / Spring Cloud 2026.0.0, with probes Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8 --- README.md | 1 + cloud-2026-upgrade/README.md | 49 ++++++++++ cloud-2026-upgrade/output/01-bom-diff.txt | 8 ++ .../output/02-properties-diff.txt | 45 ++++++++++ .../output/10-half-upgrades.txt | 26 ++++++ .../output/11-shop-before-after.txt | 32 +++++++ .../output/12-eureka-lb-trap-before.txt | 9 ++ .../output/13-eureka-lb-trap-after.txt | 5 ++ .../output/14-gateway-requests-after.txt | 46 ++++++++++ .../output/15-dependency-diff.txt | 43 +++++++++ .../output/20-trusted-proxies-webmvc.txt | 50 +++++++++++ .../output/21-trusted-proxies-webflux.txt | 50 +++++++++++ .../output/22-retry-filter-webflux.txt | 13 +++ .../output/23-websocket-origin-webflux.txt | 14 +++ .../output/24-behind-load-balancer.txt | 50 +++++++++++ .../25-shop-gateway-trusted-proxies.txt | 18 ++++ .../output/30-openfeign-querymap.txt | 14 +++ .../output/31-reactor-extra.txt | 9 ++ .../output/40-config-notify-record.txt | 31 +++++++ .../output/41-config-notify-class.txt | 31 +++++++ .../output/42-notifier-without-restclient.txt | 4 + .../output/43-native-multi-label.txt | 14 +++ .../output/50-forwarded-filters-ga.txt | 12 +++ .../output/51-http-notifier-ga.txt | 9 ++ .../probes/gateway-webflux/pom.xml | 44 +++++++++ .../upgrade/GatewayProbeApplication.java | 12 +++ .../src/main/resources/application.yml | 32 +++++++ .../probes/gateway-webmvc/pom.xml | 44 +++++++++ .../upgrade/GatewayProbeApplication.java | 12 +++ .../src/main/resources/application.yml | 14 +++ .../probes/openfeign-querymap/pom.xml | 43 +++++++++ .../upgrade/QueryMapProbeApplication.java | 49 ++++++++++ .../src/main/resources/application.yml | 1 + .../probes/preview-demos/pom.xml | 29 ++++++ .../main/java/ankurm/sc/ForwardedDemo.java | 47 ++++++++++ .../main/java/ankurm/sc/HttpNotifierDemo.java | 62 +++++++++++++ .../probes/reactor-extra/pom.xml | 33 +++++++ .../com/ankurm/upgrade/UsesReactorExtra.java | 10 +++ cloud-2026-upgrade/scripts/Echo.java | 43 +++++++++ cloud-2026-upgrade/scripts/bom-diff.py | 60 +++++++++++++ cloud-2026-upgrade/scripts/collect-shop.sh | 28 ++++++ cloud-2026-upgrade/scripts/config-notify.sh | 52 +++++++++++ cloud-2026-upgrade/scripts/dependency-diff.sh | 24 +++++ cloud-2026-upgrade/scripts/half-upgrades.sh | 12 +++ cloud-2026-upgrade/scripts/native-labels.sh | 26 ++++++ .../scripts/notify-without-restclient.sh | 12 +++ cloud-2026-upgrade/scripts/preview-demos.sh | 12 +++ cloud-2026-upgrade/scripts/probe-gateway.sh | 89 +++++++++++++++++++ cloud-2026-upgrade/scripts/probe-libs.sh | 30 +++++++ cloud-2026-upgrade/scripts/props-diff.py | 42 +++++++++ cloud-2026-upgrade/scripts/run-all.sh | 39 ++++++++ cloud-2026-upgrade/scripts/shop-scenarios.sh | 6 ++ .../scripts/shop-trusted-proxies.sh | 23 +++++ cloud-2026-upgrade/scripts/upgrade.sh | 16 ++++ cloud-2026-upgrade/steps/01-patch-line.patch | 22 +++++ cloud-2026-upgrade/steps/02-paddington.patch | 22 +++++ .../steps/03-trusted-proxies.patch | 14 +++ .../steps/04-config-notify.patch | 54 +++++++++++ .../steps/05-refreshable-properties.patch | 28 ++++++ 59 files changed, 1669 insertions(+) create mode 100644 cloud-2026-upgrade/README.md create mode 100644 cloud-2026-upgrade/output/01-bom-diff.txt create mode 100644 cloud-2026-upgrade/output/02-properties-diff.txt create mode 100644 cloud-2026-upgrade/output/10-half-upgrades.txt create mode 100644 cloud-2026-upgrade/output/11-shop-before-after.txt create mode 100644 cloud-2026-upgrade/output/12-eureka-lb-trap-before.txt create mode 100644 cloud-2026-upgrade/output/13-eureka-lb-trap-after.txt create mode 100644 cloud-2026-upgrade/output/14-gateway-requests-after.txt create mode 100644 cloud-2026-upgrade/output/15-dependency-diff.txt create mode 100644 cloud-2026-upgrade/output/20-trusted-proxies-webmvc.txt create mode 100644 cloud-2026-upgrade/output/21-trusted-proxies-webflux.txt create mode 100644 cloud-2026-upgrade/output/22-retry-filter-webflux.txt create mode 100644 cloud-2026-upgrade/output/23-websocket-origin-webflux.txt create mode 100644 cloud-2026-upgrade/output/24-behind-load-balancer.txt create mode 100644 cloud-2026-upgrade/output/25-shop-gateway-trusted-proxies.txt create mode 100644 cloud-2026-upgrade/output/30-openfeign-querymap.txt create mode 100644 cloud-2026-upgrade/output/31-reactor-extra.txt create mode 100644 cloud-2026-upgrade/output/40-config-notify-record.txt create mode 100644 cloud-2026-upgrade/output/41-config-notify-class.txt create mode 100644 cloud-2026-upgrade/output/42-notifier-without-restclient.txt create mode 100644 cloud-2026-upgrade/output/43-native-multi-label.txt create mode 100644 cloud-2026-upgrade/output/50-forwarded-filters-ga.txt create mode 100644 cloud-2026-upgrade/output/51-http-notifier-ga.txt create mode 100644 cloud-2026-upgrade/probes/gateway-webflux/pom.xml create mode 100644 cloud-2026-upgrade/probes/gateway-webflux/src/main/java/com/ankurm/upgrade/GatewayProbeApplication.java create mode 100644 cloud-2026-upgrade/probes/gateway-webflux/src/main/resources/application.yml create mode 100644 cloud-2026-upgrade/probes/gateway-webmvc/pom.xml create mode 100644 cloud-2026-upgrade/probes/gateway-webmvc/src/main/java/com/ankurm/upgrade/GatewayProbeApplication.java create mode 100644 cloud-2026-upgrade/probes/gateway-webmvc/src/main/resources/application.yml create mode 100644 cloud-2026-upgrade/probes/openfeign-querymap/pom.xml create mode 100644 cloud-2026-upgrade/probes/openfeign-querymap/src/main/java/com/ankurm/upgrade/QueryMapProbeApplication.java create mode 100644 cloud-2026-upgrade/probes/openfeign-querymap/src/main/resources/application.yml create mode 100644 cloud-2026-upgrade/probes/preview-demos/pom.xml create mode 100644 cloud-2026-upgrade/probes/preview-demos/src/main/java/ankurm/sc/ForwardedDemo.java create mode 100644 cloud-2026-upgrade/probes/preview-demos/src/main/java/ankurm/sc/HttpNotifierDemo.java create mode 100644 cloud-2026-upgrade/probes/reactor-extra/pom.xml create mode 100644 cloud-2026-upgrade/probes/reactor-extra/src/main/java/com/ankurm/upgrade/UsesReactorExtra.java create mode 100644 cloud-2026-upgrade/scripts/Echo.java create mode 100644 cloud-2026-upgrade/scripts/bom-diff.py create mode 100755 cloud-2026-upgrade/scripts/collect-shop.sh create mode 100755 cloud-2026-upgrade/scripts/config-notify.sh create mode 100755 cloud-2026-upgrade/scripts/dependency-diff.sh create mode 100755 cloud-2026-upgrade/scripts/half-upgrades.sh create mode 100755 cloud-2026-upgrade/scripts/native-labels.sh create mode 100755 cloud-2026-upgrade/scripts/notify-without-restclient.sh create mode 100755 cloud-2026-upgrade/scripts/preview-demos.sh create mode 100755 cloud-2026-upgrade/scripts/probe-gateway.sh create mode 100755 cloud-2026-upgrade/scripts/probe-libs.sh create mode 100644 cloud-2026-upgrade/scripts/props-diff.py create mode 100755 cloud-2026-upgrade/scripts/run-all.sh create mode 100755 cloud-2026-upgrade/scripts/shop-scenarios.sh create mode 100755 cloud-2026-upgrade/scripts/shop-trusted-proxies.sh create mode 100755 cloud-2026-upgrade/scripts/upgrade.sh create mode 100644 cloud-2026-upgrade/steps/01-patch-line.patch create mode 100644 cloud-2026-upgrade/steps/02-paddington.patch create mode 100644 cloud-2026-upgrade/steps/03-trusted-proxies.patch create mode 100644 cloud-2026-upgrade/steps/04-config-notify.patch create mode 100644 cloud-2026-upgrade/steps/05-refreshable-properties.patch diff --git a/README.md b/README.md index a9522b0..fdd64a4 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ discovery-server :8761 (Eureka) every service registers here and finds the othe | `inventory-service` | stock levels, `POST /inventory/{id}/reserve`, a switch to simulate an outage | | `openfeign-demo` | standalone, **not** part of the build above: OpenFeign vs `@HttpExchange` on Boot 4.2.0 / Cloud 2026.0.0; see its own README | | `gateway-mvc` | standalone, **not** part of the build above: Gateway Server MVC 5.1 on Boot 4.2.0 / Cloud 2026.0.0 with virtual threads, retry, Redis rate limiting; see its own README | +| `cloud-2026-upgrade` | standalone, **not** part of the build above: step-by-step upgrade of this project to Boot 4.2.0 / Spring Cloud 2026.0.0, with probes; see its own README | | `order-service` | `POST /orders`; calls product-service and inventory-service through the load balancer and a Resilience4j circuit breaker | ## Run it (no Docker needed) diff --git a/cloud-2026-upgrade/README.md b/cloud-2026-upgrade/README.md new file mode 100644 index 0000000..d57eaf5 --- /dev/null +++ b/cloud-2026-upgrade/README.md @@ -0,0 +1,49 @@ +# cloud-2026-upgrade + +Upgrading this repository's six-service shop from **Spring Cloud 2025.1 (Oakwood)** to **2026.0.0 (Paddington)** on +**Spring Boot 4.2.0**, written for +[Spring Cloud 2026.0 (Paddington) Migration Guide](https://ankurm.com/spring-cloud-2026-0-paddington-migration-guide/). +The explanation lives in the article; this folder holds what was run. + +Nothing in the parent project is modified. `scripts/upgrade.sh` copies it into `run/` and applies the patches in `steps/`. + +| Step | Patch | Change | +|---|---|---| +| 1 | `01-patch-line.patch` | Boot 4.1.1 -> 4.1.3, Cloud 2025.1.3 -> 2025.1.5 | +| 2 | `02-paddington.patch` | Boot 4.2.0 and Cloud 2026.0.0, together | +| 3 | `03-trusted-proxies.patch` | gateway reads `TRUSTED_PROXIES` | +| 4 | `04-config-notify.patch` | config server gets `/monitor` and the HTTP notifier | +| 5 | `05-refreshable-properties.patch` | `OrderProperties` stops being a record so a refresh reaches it | + +## Run + +JDK 25, Maven 3.9+, curl, python3, openssl, patch. The ports listed in `scripts/run-all.sh` must be free. + +```bash +./scripts/upgrade.sh 5 # just produce the upgraded copy in run/shop +./scripts/run-all.sh # rebuild everything and regenerate output/ +``` + +## Probes (`probes/`) + +| Folder | Question | +|---|---| +| `gateway-webmvc`, `gateway-webflux` | what reaches the backend with each trusted-proxies setting; retry count; WebSocket Origin check | +| `openfeign-querymap` | nested objects in `@SpringQueryMap` | +| `reactor-extra` | code that relied on a transitive dependency | +| `preview-demos` | the two class-level demos of the earlier preview article, on the GA jars | + +## Captured output + +| File | Shows | +|---|---| +| `01-bom-diff.txt`, `02-properties-diff.txt` | managed artifacts and configuration properties, 2025.1.5 vs 2026.0.0 | +| `10-half-upgrades.txt` | startup failure when only Boot or only Cloud is bumped | +| `11`-`15` | shop scenarios before and after, the Eureka load-balancer trap, dependency changes | +| `20`-`25` | gateway forwarding headers, retry, WebSocket origin | +| `30`, `31` | OpenFeign query maps, reactor-extra | +| `40`-`43` | `/monitor`, HTTP notifier, records vs classes, missing `RestClient.Builder`, native multi-label order | +| `50`, `51` | forwarded-header filters and `HttpPropertyPathNotifier` called directly | + +Run with `MVN_ARGS` for a Maven settings file and `MAVEN_REPO` to point the two diff scripts at a mirror. +Docker was not used. The Kafka and RabbitMQ binders, Kubernetes, Vault, Consul, Zookeeper, Function and Task were not run here. diff --git a/cloud-2026-upgrade/output/01-bom-diff.txt b/cloud-2026-upgrade/output/01-bom-diff.txt new file mode 100644 index 0000000..529732b --- /dev/null +++ b/cloud-2026-upgrade/output/01-bom-diff.txt @@ -0,0 +1,8 @@ +# org.springframework.cloud artifacts managed by spring-cloud-dependencies 2025.1.5 vs 2026.0.0 +managed in 2025.1.5: 115 managed in 2026.0.0: 114 + +REMOVED (1) + org.springframework.cloud:spring-cloud-function-deployer:5.0.6 + (but that version's POM is NOT in the repository: 404) + +ADDED (0) diff --git a/cloud-2026-upgrade/output/02-properties-diff.txt b/cloud-2026-upgrade/output/02-properties-diff.txt new file mode 100644 index 0000000..22d674b --- /dev/null +++ b/cloud-2026-upgrade/output/02-properties-diff.txt @@ -0,0 +1,45 @@ +== spring-cloud-commons 5.0.5 -> 5.1.0: 75 -> 78 properties + added spring.cloud.discovery.reactive.combine-instances (default False) + added spring.cloud.discovery.reactive.enabled (default True) + added spring.cloud.discovery.reactive.order-enforced (default False) + default changed spring.cloud.compatibility-verifier.compatible-boot-versions: None -> 4.2.x +== spring-cloud-context 5.0.5 -> 5.1.0: 30 -> 30 properties +== spring-cloud-loadbalancer 5.0.5 -> 5.1.0: 11 -> 11 properties +== spring-cloud-config-client 5.0.7 -> 5.1.0: 26 -> 30 properties + added spring.cloud.config.oauth2.client-registration-id + added spring.cloud.config.oauth2.enabled (default False) + added spring.cloud.config.resource-client.max-size (default 1MB) + added spring.cloud.config.retry.enabled (default False) + newly deprecated spring.cloud.config.retry.use-random-policy -> (no replacement) +== spring-cloud-config-server 5.0.7 -> 5.1.0: 166 -> 180 properties + added spring.cloud.config.server.gcp-parameter-manager.application-label (default application) + added spring.cloud.config.server.gcp-parameter-manager.default-label (default main) + added spring.cloud.config.server.gcp-parameter-manager.location (default global) + added spring.cloud.config.server.gcp-parameter-manager.order + added spring.cloud.config.server.gcp-parameter-manager.profile-label (default profile) + added spring.cloud.config.server.gcp-parameter-manager.project-id + added spring.cloud.config.server.gcs.bucket + added spring.cloud.config.server.gcs.order + added spring.cloud.config.server.gcs.project-id + added spring.cloud.config.server.gcs.search-paths + added spring.cloud.config.server.gcs.use-directory-layout (default False) + added spring.cloud.config.server.git.azure.identity.client-id + added spring.cloud.config.server.git.azure.identity.managed-identity-enabled (default False) + added spring.cloud.config.server.native.last-label-wins (default True) +== spring-cloud-config-monitor 5.0.7 -> 5.1.0: 23 -> 24 properties + added spring.cloud.config.server.monitor.http.endpoints +== spring-cloud-gateway-server-webflux 5.0.5 -> 5.1.0: 177 -> 177 properties +== spring-cloud-gateway-server-webmvc 5.0.5 -> 5.1.0: 27 -> 34 properties + added spring.cloud.gateway.server.webmvc.websocket.allowed-origin-patterns + added spring.cloud.gateway.server.webmvc.websocket.allowed-origins + added spring.cloud.gateway.server.webmvc.websocket.connect-timeout (default 10s) + added spring.cloud.gateway.server.webmvc.websocket.enabled (default True) + added spring.cloud.gateway.server.webmvc.websocket.max-message-size (default 64KB) + added spring.cloud.gateway.server.webmvc.websocket.send-buffer-size-limit (default 512KB) + added spring.cloud.gateway.server.webmvc.websocket.send-time-limit (default 10s) +== spring-cloud-openfeign-core 5.0.4 -> 5.1.0: 38 -> 38 properties +== spring-cloud-stream 5.0.5 -> 5.1.0: 25 -> 25 properties +== spring-cloud-netflix-eureka-client 5.0.4 -> 5.1.0: 93 -> 94 properties + added eureka.client.status.mapping +== spring-cloud-netflix-eureka-server 5.0.4 -> 5.1.0: 83 -> 83 properties +== spring-cloud-circuitbreaker-resilience4j 5.0.3 -> 5.1.0: 11 -> 11 properties diff --git a/cloud-2026-upgrade/output/10-half-upgrades.txt b/cloud-2026-upgrade/output/10-half-upgrades.txt new file mode 100644 index 0000000..1851185 --- /dev/null +++ b/cloud-2026-upgrade/output/10-half-upgrades.txt @@ -0,0 +1,26 @@ +=== Boot 4.2.0 with Spring Cloud 2025.1.5 +APPLICATION FAILED TO START +*************************** +Description: +Your project setup is incompatible with our requirements due to following reasons: +- Spring Boot [4.2.0] is not compatible with this Spring Cloud release train +Action: +Consider applying the following actions: +- Change Spring Boot version to one of the following versions [4.0.x, 4.1.x]. +You can find the latest Spring Boot versions here [https://spring.io/projects/spring-boot#learn]. +If you want to learn more about the Spring Cloud Release train compatibility, you can visit this page [https://spring.io/projects/spring-cloud#overview] and check the [Release Trains] section. +If you want to disable this check, just set the property [spring.cloud.compatibility-verifier.enabled=false] + +=== Boot 4.1.3 with Spring Cloud 2026.0.0 +APPLICATION FAILED TO START +*************************** +Description: +Your project setup is incompatible with our requirements due to following reasons: +- Spring Boot [4.1.3] is not compatible with this Spring Cloud release train +Action: +Consider applying the following actions: +- Change Spring Boot version to one of the following versions [4.2.x]. +You can find the latest Spring Boot versions here [https://spring.io/projects/spring-boot#learn]. +If you want to learn more about the Spring Cloud Release train compatibility, you can visit this page [https://spring.io/projects/spring-cloud#overview] and check the [Release Trains] section. +If you want to disable this check, just set the property [spring.cloud.compatibility-verifier.enabled=false] + diff --git a/cloud-2026-upgrade/output/11-shop-before-after.txt b/cloud-2026-upgrade/output/11-shop-before-after.txt new file mode 100644 index 0000000..3fb3509 --- /dev/null +++ b/cloud-2026-upgrade/output/11-shop-before-after.txt @@ -0,0 +1,32 @@ +# The shop's scenario files, compared with Boot 4.1.3 / 2025.1.5 (timestamps and trace ids masked). +# 00-startup-race.txt is left out: it records timing. + +=== Boot 4.2.0 / 2026.0.0, only the two version numbers changed (step 2) +01-config-server.txt: identical +02-eureka-registry.txt: identical +03-gateway-requests.txt: identical +04-trace-propagation.txt: identical +05-circuit-breaker.txt: identical +06-eureka-lb-trap.txt: DIFFERENT + < org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'scopedTar + < c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='ht + < com.netflix.discovery.DiscoveryClient : DiscoveryClient_ORDER-SERVICE/order-service:8092 - registration f + +=== Boot 4.2.0 / 2026.0.0, all five steps applied +01-config-server.txt: DIFFERENT + < management.endpoints.web.exposure.include = health,info,circuitbreakers + > management.endpoints.web.exposure.include = health,info,circuitbreakers,refresh +02-eureka-registry.txt: DIFFERENT + > CONFIG-SERVER instance=config-server:8888 status=UP +03-gateway-requests.txt: identical +04-trace-propagation.txt: identical +05-circuit-breaker.txt: identical +06-eureka-lb-trap.txt: DIFFERENT + < org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'scopedTar + < c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='ht + < com.netflix.discovery.DiscoveryClient : DiscoveryClient_ORDER-SERVICE/order-service:8092 - registration f + < order-service:8092 registered: False + > order-service:8092 registered: True + +The yes/no registry line in 06-eureka-lb-trap.txt varies between runs on 2026.0.0 (Eureka caches that answer); +the registration itself is recorded in 13-eureka-lb-trap-after.txt. diff --git a/cloud-2026-upgrade/output/12-eureka-lb-trap-before.txt b/cloud-2026-upgrade/output/12-eureka-lb-trap-before.txt new file mode 100644 index 0000000..79a0d38 --- /dev/null +++ b/cloud-2026-upgrade/output/12-eureka-lb-trap-before.txt @@ -0,0 +1,9 @@ +# order-service started with --shop.demo.primary-builder=false (the only RestClient.Builder is the @LoadBalanced one) + +--- the log lines that give it away --- +org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'scopedTarget.eurekaClient': Requested bean is currently in creation: Is there an unresolvable circular reference or an as +c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}, exception=No instances available for localhost +com.netflix.discovery.DiscoveryClient : DiscoveryClient_ORDER-SERVICE/order-service:8092 - registration failed Cannot execute request on any known server + +--- is instance order-service:8092 in Eureka? --- +order-service:8092 registered: False diff --git a/cloud-2026-upgrade/output/13-eureka-lb-trap-after.txt b/cloud-2026-upgrade/output/13-eureka-lb-trap-after.txt new file mode 100644 index 0000000..ec83062 --- /dev/null +++ b/cloud-2026-upgrade/output/13-eureka-lb-trap-after.txt @@ -0,0 +1,5 @@ +# order-service on 2026.0.0 with --shop.demo.primary-builder=false, taken from its own log + +lines with BeanCurrentlyInCreationException: 0 +lines with 'No instances available for localhost': 0 +DiscoveryClient_ORDER-SERVICE/order-service:8092 - registration status: 204 diff --git a/cloud-2026-upgrade/output/14-gateway-requests-after.txt b/cloud-2026-upgrade/output/14-gateway-requests-after.txt new file mode 100644 index 0000000..bee419e --- /dev/null +++ b/cloud-2026-upgrade/output/14-gateway-requests-after.txt @@ -0,0 +1,46 @@ +# Requests through the gateway (port 8080). The client only ever talks to 8080. + +--- products --- +$ curl -X GET localhost:8080/api/products +HTTP 200 +[{"id":1,"name":"Mechanical keyboard","price":89.90},{"id":2,"name":"USB-C dock","price":129.00},{"id":3,"name":"27-inch monitor","price":249.50}] + +$ curl -X GET localhost:8080/api/products/2 +HTTP 200 +{"id":2,"name":"USB-C dock","price":129.00} + +$ curl -X GET localhost:8080/api/products/99 +HTTP 404 +{"timestamp":"2026-12-04T02:31:24.354Z","status":404,"error":"Not Found","path":"/products/99"} + +--- stock --- +$ curl -X GET localhost:8080/api/inventory/3 +HTTP 200 +{"productId":3,"quantity":3,"lowStock":true} + +--- orders --- +$ curl -X POST localhost:8080/api/orders -d '{"productId":1,"quantity":2}' +HTTP 201 +{"id":1,"productId":1,"productName":"Mechanical keyboard","quantity":2,"total":179.80,"currency":"EUR","status":"CONFIRMED"} + +$ curl -X POST localhost:8080/api/orders -d '{"productId":3,"quantity":4}' +HTTP 409 +{"timestamp":"2026-12-04T02:31:24.672Z","status":409,"error":"Conflict","path":"/orders"} + +$ curl -X POST localhost:8080/api/orders -d '{"productId":2,"quantity":11}' +HTTP 400 +{"timestamp":"2026-12-04T02:31:24.717Z","status":400,"error":"Bad Request","path":"/orders"} + +$ curl -X POST localhost:8080/api/orders -d '{"productId":99,"quantity":1}' +HTTP 404 +{"timestamp":"2026-12-04T02:31:24.788Z","status":404,"error":"Not Found","path":"/orders"} + +$ curl -X GET localhost:8080/api/orders +HTTP 200 +[{"id":1,"productId":1,"productName":"Mechanical keyboard","quantity":2,"total":179.80,"currency":"EUR","status":"CONFIRMED"}] + +--- stock after the first order --- +$ curl -X GET localhost:8080/api/inventory/1 +HTTP 200 +{"productId":1,"quantity":18,"lowStock":false} + diff --git a/cloud-2026-upgrade/output/15-dependency-diff.txt b/cloud-2026-upgrade/output/15-dependency-diff.txt new file mode 100644 index 0000000..ec33751 --- /dev/null +++ b/cloud-2026-upgrade/output/15-dependency-diff.txt @@ -0,0 +1,43 @@ +# Libraries of the six services: Boot 4.1.3 / 2025.1.5 -> Boot 4.2.0 / 2026.0.0 (selected groups) +io.github.resilience4j:resilience4j-annotations 2.3.0 -> 2.4.0 +io.github.resilience4j:resilience4j-circuitbreaker 2.3.0 -> 2.4.0 +io.github.resilience4j:resilience4j-circularbuffer 2.3.0 -> 2.4.0 +io.github.resilience4j:resilience4j-consumer 2.3.0 -> 2.4.0 +io.github.resilience4j:resilience4j-core 2.3.0 -> 2.4.0 +io.github.resilience4j:resilience4j-framework-common 2.3.0 -> 2.4.0 +io.github.resilience4j:resilience4j-micrometer 2.3.0 -> 2.4.0 +io.github.resilience4j:resilience4j-ratelimiter 2.3.0 -> 2.4.0 +io.github.resilience4j:resilience4j-retry 2.3.0 -> 2.4.0 +io.github.resilience4j:resilience4j-spring-boot3 2.3.0 -> (gone) +io.github.resilience4j:resilience4j-spring-boot4 (absent) -> 2.4.0 +io.github.resilience4j:resilience4j-spring6 2.3.0 -> 2.4.0 +io.github.resilience4j:resilience4j-timelimiter 2.3.0 -> 2.4.0 +io.micrometer:micrometer-core 1.17.3 -> 1.18.0 +io.projectreactor.addons:reactor-extra 3.6.2 -> (gone) +io.projectreactor:reactor-core 3.8.9 -> 3.9.0 +org.eclipse.jgit:org.eclipse.jgit 7.4.0.202509020913-r -> 7.8.1.202611041320-r +org.eclipse.jgit:org.eclipse.jgit.http.apache 7.4.0.202509020913-r -> 7.8.1.202611041320-r +org.eclipse.jgit:org.eclipse.jgit.ssh.apache 7.4.0.202509020913-r -> 7.8.1.202611041320-r +org.jetbrains.kotlin:kotlin-stdlib 2.3.21 -> (gone) +org.jetbrains.kotlin:kotlin-stdlib-jdk7 2.3.21 -> (gone) +org.jetbrains.kotlin:kotlin-stdlib-jdk8 2.3.21 -> (gone) +org.jetbrains:annotations 13.0 -> (gone) +org.springframework.boot:spring-boot 4.1.3 -> 4.2.0 +org.springframework.cloud:spring-cloud-circuitbreaker-resilience4j 5.0.3 -> 5.1.0 +org.springframework.cloud:spring-cloud-commons 5.0.5 -> 5.1.0 +org.springframework.cloud:spring-cloud-config-client 5.0.7 -> 5.1.0 +org.springframework.cloud:spring-cloud-config-monitor (absent) -> 5.1.0 +org.springframework.cloud:spring-cloud-config-server 5.0.7 -> 5.1.0 +org.springframework.cloud:spring-cloud-context 5.0.5 -> 5.1.0 +org.springframework.cloud:spring-cloud-gateway-server-webmvc 5.0.5 -> 5.1.0 +org.springframework.cloud:spring-cloud-loadbalancer 5.0.5 -> 5.1.0 +org.springframework.cloud:spring-cloud-netflix-eureka-client 5.0.4 -> 5.1.0 +org.springframework.cloud:spring-cloud-netflix-eureka-server 5.0.4 -> 5.1.0 +org.springframework.cloud:spring-cloud-starter 5.0.5 -> 5.1.0 +org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j 5.0.3 -> 5.1.0 +org.springframework.cloud:spring-cloud-starter-config 5.0.7 -> 5.1.0 +org.springframework.cloud:spring-cloud-starter-gateway-server-webmvc 5.0.5 -> 5.1.0 +org.springframework.cloud:spring-cloud-starter-loadbalancer 5.0.5 -> 5.1.0 +org.springframework.cloud:spring-cloud-starter-netflix-eureka-client 5.0.4 -> 5.1.0 +org.springframework.cloud:spring-cloud-starter-netflix-eureka-server 5.0.4 -> 5.1.0 +org.springframework:spring-core 7.0.11 -> 7.1.0 diff --git a/cloud-2026-upgrade/output/20-trusted-proxies-webmvc.txt b/cloud-2026-upgrade/output/20-trusted-proxies-webmvc.txt new file mode 100644 index 0000000..5cfe96f --- /dev/null +++ b/cloud-2026-upgrade/output/20-trusted-proxies-webmvc.txt @@ -0,0 +1,50 @@ +# Gateway Server webmvc. The client is 127.0.0.1 and sends forged headers: +# Forwarded: for=198.51.100.7;proto=https X-Forwarded-For: 198.51.100.7 X-Forwarded-Proto: https +# Below: the forwarding headers the backend actually received. + +=== Boot 4.1.3 / Spring Cloud 2025.1.3 | trusted-proxies not set +(no Forwarded or X-Forwarded-* header at all) + +=== Boot 4.1.3 / Spring Cloud 2025.1.3 | trusted-proxies=10\..* (caller NOT trusted) +(no Forwarded or X-Forwarded-* header at all) + +=== Boot 4.1.3 / Spring Cloud 2025.1.3 | trusted-proxies=127\.0\.0\.1 (caller trusted) +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8090 +x-forwarded-port: 8090 +x-forwarded-proto: https,http + +=== Boot 4.1.3 / Spring Cloud 2025.1.5 | trusted-proxies not set +(no Forwarded or X-Forwarded-* header at all) + +=== Boot 4.1.3 / Spring Cloud 2025.1.5 | trusted-proxies=10\..* (caller NOT trusted) +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8090 +x-forwarded-port: 8090 +x-forwarded-proto: http + +=== Boot 4.1.3 / Spring Cloud 2025.1.5 | trusted-proxies=127\.0\.0\.1 (caller trusted) +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8090 +x-forwarded-port: 8090 +x-forwarded-proto: https,http + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 | trusted-proxies not set +(no Forwarded or X-Forwarded-* header at all) + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 | trusted-proxies=10\..* (caller NOT trusted) +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8090 +x-forwarded-port: 8090 +x-forwarded-proto: http + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 | trusted-proxies=127\.0\.0\.1 (caller trusted) +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8090 +x-forwarded-port: 8090 +x-forwarded-proto: https,http diff --git a/cloud-2026-upgrade/output/21-trusted-proxies-webflux.txt b/cloud-2026-upgrade/output/21-trusted-proxies-webflux.txt new file mode 100644 index 0000000..083f927 --- /dev/null +++ b/cloud-2026-upgrade/output/21-trusted-proxies-webflux.txt @@ -0,0 +1,50 @@ +# Gateway Server webflux. The client is 127.0.0.1 and sends forged headers: +# Forwarded: for=198.51.100.7;proto=https X-Forwarded-For: 198.51.100.7 X-Forwarded-Proto: https +# Below: the forwarding headers the backend actually received. + +=== Boot 4.1.3 / Spring Cloud 2025.1.3 | trusted-proxies not set +(no Forwarded or X-Forwarded-* header at all) + +=== Boot 4.1.3 / Spring Cloud 2025.1.3 | trusted-proxies=10\..* (caller NOT trusted) +(no Forwarded or X-Forwarded-* header at all) + +=== Boot 4.1.3 / Spring Cloud 2025.1.3 | trusted-proxies=127\.0\.0\.1 (caller trusted) +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8090 +x-forwarded-port: 8090 +x-forwarded-proto: https,http + +=== Boot 4.1.3 / Spring Cloud 2025.1.5 | trusted-proxies not set +(no Forwarded or X-Forwarded-* header at all) + +=== Boot 4.1.3 / Spring Cloud 2025.1.5 | trusted-proxies=10\..* (caller NOT trusted) +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8090 +x-forwarded-port: 8090 +x-forwarded-proto: http + +=== Boot 4.1.3 / Spring Cloud 2025.1.5 | trusted-proxies=127\.0\.0\.1 (caller trusted) +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8090 +x-forwarded-port: 8090 +x-forwarded-proto: https,http + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 | trusted-proxies not set +(no Forwarded or X-Forwarded-* header at all) + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 | trusted-proxies=10\..* (caller NOT trusted) +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8090 +x-forwarded-port: 8090 +x-forwarded-proto: http + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 | trusted-proxies=127\.0\.0\.1 (caller trusted) +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8090 +x-forwarded-port: 8090 +x-forwarded-proto: https,http diff --git a/cloud-2026-upgrade/output/22-retry-filter-webflux.txt b/cloud-2026-upgrade/output/22-retry-filter-webflux.txt new file mode 100644 index 0000000..a72631e --- /dev/null +++ b/cloud-2026-upgrade/output/22-retry-filter-webflux.txt @@ -0,0 +1,13 @@ +# WebFlux gateway, Retry filter (retries: 3, statuses: INTERNAL_SERVER_ERROR) in front of a backend that always answers 500. + +=== Boot 4.1.3 / Spring Cloud 2025.1.3 +client status: 500 +upstream calls to /flaky: 4 + +=== Boot 4.1.3 / Spring Cloud 2025.1.5 +client status: 500 +upstream calls to /flaky: 4 + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 +client status: 500 +upstream calls to /flaky: 4 diff --git a/cloud-2026-upgrade/output/23-websocket-origin-webflux.txt b/cloud-2026-upgrade/output/23-websocket-origin-webflux.txt new file mode 100644 index 0000000..20ea3be --- /dev/null +++ b/cloud-2026-upgrade/output/23-websocket-origin-webflux.txt @@ -0,0 +1,14 @@ +# WebFlux gateway with a ws:// route. A handshake with a foreign Origin header. +# The backend is a plain HTTP server, so a handshake the gateway lets through fails further down. + +=== Boot 4.1.3 / Spring Cloud 2025.1.3 +HTTP/1.1 101 Switching Protocols + + +=== Boot 4.1.3 / Spring Cloud 2025.1.5 +HTTP/1.1 403 Forbidden + + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 +HTTP/1.1 403 Forbidden + diff --git a/cloud-2026-upgrade/output/24-behind-load-balancer.txt b/cloud-2026-upgrade/output/24-behind-load-balancer.txt new file mode 100644 index 0000000..f2de2b9 --- /dev/null +++ b/cloud-2026-upgrade/output/24-behind-load-balancer.txt @@ -0,0 +1,50 @@ +# 127.0.0.1 plays a load balancer. It sends: X-Forwarded-For: 203.0.113.50 Forwarded: for=203.0.113.50;proto=https +# 203.0.113.50 is the real client. Does it survive the gateway? + +=== webmvc | Spring Cloud 2025.1.3 | trusted-proxies=127\.0\.0\.1 +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 + +=== webmvc | Spring Cloud 2025.1.3 | trusted-proxies=127\.0\.0\.1|203\.0\.113\.50 +forwarded: for=203.0.113.50;proto=https | proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 203.0.113.50,127.0.0.1 + +=== webmvc | Spring Cloud 2025.1.5 | trusted-proxies=127\.0\.0\.1 +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 + +=== webmvc | Spring Cloud 2025.1.5 | trusted-proxies=127\.0\.0\.1|203\.0\.113\.50 +forwarded: for=203.0.113.50;proto=https | proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 203.0.113.50,127.0.0.1 + +=== webmvc | Spring Cloud 2026.0.0 | trusted-proxies=127\.0\.0\.1 +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 + +=== webmvc | Spring Cloud 2026.0.0 | trusted-proxies=127\.0\.0\.1|203\.0\.113\.50 +forwarded: for=203.0.113.50;proto=https | proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 203.0.113.50,127.0.0.1 + +=== webflux | Spring Cloud 2025.1.3 | trusted-proxies=127\.0\.0\.1 +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 + +=== webflux | Spring Cloud 2025.1.3 | trusted-proxies=127\.0\.0\.1|203\.0\.113\.50 +forwarded: for=203.0.113.50;proto=https | proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 203.0.113.50,127.0.0.1 + +=== webflux | Spring Cloud 2025.1.5 | trusted-proxies=127\.0\.0\.1 +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 + +=== webflux | Spring Cloud 2025.1.5 | trusted-proxies=127\.0\.0\.1|203\.0\.113\.50 +forwarded: for=203.0.113.50;proto=https | proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 203.0.113.50,127.0.0.1 + +=== webflux | Spring Cloud 2026.0.0 | trusted-proxies=127\.0\.0\.1 +forwarded: proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 + +=== webflux | Spring Cloud 2026.0.0 | trusted-proxies=127\.0\.0\.1|203\.0\.113\.50 +forwarded: for=203.0.113.50;proto=https | proto=http;host="localhost:8090";for="127.0.0.1:" +x-forwarded-for: 203.0.113.50,127.0.0.1 diff --git a/cloud-2026-upgrade/output/25-shop-gateway-trusted-proxies.txt b/cloud-2026-upgrade/output/25-shop-gateway-trusted-proxies.txt new file mode 100644 index 0000000..dfec7d3 --- /dev/null +++ b/cloud-2026-upgrade/output/25-shop-gateway-trusted-proxies.txt @@ -0,0 +1,18 @@ +# The shop gateway (WebMVC) on Spring Cloud 2026.0.0, client 127.0.0.1 sending: X-Forwarded-For: 198.51.100.7 + +=== TRUSTED_PROXIES= +(no Forwarded or X-Forwarded-* header at all) + +=== TRUSTED_PROXIES=10\..* +forwarded: proto=http;host="localhost:8080";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8080 +x-forwarded-port: 8080 +x-forwarded-proto: http + +=== TRUSTED_PROXIES=127\.0\.0\.1 +forwarded: proto=http;host="localhost:8080";for="127.0.0.1:" +x-forwarded-for: 127.0.0.1 +x-forwarded-host: localhost:8080 +x-forwarded-port: 8080 +x-forwarded-proto: http diff --git a/cloud-2026-upgrade/output/30-openfeign-querymap.txt b/cloud-2026-upgrade/output/30-openfeign-querymap.txt new file mode 100644 index 0000000..04fc221 --- /dev/null +++ b/cloud-2026-upgrade/output/30-openfeign-querymap.txt @@ -0,0 +1,14 @@ +# A record with a nested record, a list and a map, sent with @SpringQueryMap. What the server received (URL-decoded). + +=== Boot 4.1.3 / Spring Cloud 2025.1.5 +query string received: price=Price[min=10, max=200]&text=dock&tags=usb&tags=hub&attrs={colour=black} +feign-core-13.6.1.jar +spring-cloud-openfeign-core-5.0.4.jar + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 +query string received: price=Price[min=10, max=200]&text=dock&tags=usb&tags=hub&attrs={colour=black} +feign-core-13.17.jar +spring-cloud-openfeign-core-5.1.0.jar + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 + spring.cloud.openfeign.client.config.default.nested-query-map-enabled=true +query string received: price.min=10&price.max=200&text=dock&tags=usb&tags=hub&attrs[colour]=black diff --git a/cloud-2026-upgrade/output/31-reactor-extra.txt b/cloud-2026-upgrade/output/31-reactor-extra.txt new file mode 100644 index 0000000..abdd9b9 --- /dev/null +++ b/cloud-2026-upgrade/output/31-reactor-extra.txt @@ -0,0 +1,9 @@ +# A class that imports reactor.retry.Repeat in a project that declares only spring-cloud-starter-loadbalancer. + +=== Boot 4.1.3 / Spring Cloud 2025.1.5 +compiles + +=== Boot 4.2.0 / Spring Cloud 2026.0.0 +[ERROR] probes/reactor-extra/src/main/java/com/ankurm/upgrade/UsesReactorExtra.java:[3,21] package reactor.retry does not exist +[ERROR] probes/reactor-extra/src/main/java/com/ankurm/upgrade/UsesReactorExtra.java:[8,16] cannot find symbol +[ERROR] probes/reactor-extra/src/main/java/com/ankurm/upgrade/UsesReactorExtra.java:[3,21] package reactor.retry does not exist diff --git a/cloud-2026-upgrade/output/40-config-notify-record.txt b/cloud-2026-upgrade/output/40-config-notify-record.txt new file mode 100644 index 0000000..f27bd3d --- /dev/null +++ b/cloud-2026-upgrade/output/40-config-notify-record.txt @@ -0,0 +1,31 @@ +# order-service reads shop.order.* from the config server. OrderProperties is a Java record. + +--- before +$ curl localhost:8082/orders/config +{"currency":"EUR","maxQuantity":10} + +--- an unsigned request to /monitor (the curl most tutorials show) +$ curl -X POST localhost:8888/monitor -d path=order-service +HTTP 403 + +--- edit order-service.yml in the config repository: currency EUR -> USD, max-quantity 10 -> 3 +(no request sent: with a local file: repository the monitor module watches the directory itself) + +--- config server log +INFO o.s.c.c.m.FileMonitorConfiguration : Monitoring for local config changes: [run/config] +INFO o.s.c.c.monitor.PropertyPathEndpoint : Refresh for: order-service + +--- order-service log +INFO o.s.cloud.endpoint.RefreshEndpoint : Refreshed keys : [shop.order.currency, shop.order.max-quantity] + +--- what order-service uses after the refresh +$ curl localhost:8082/orders/config +{"currency":"EUR","maxQuantity":10} + +--- a signed GitHub-style push webhook, the way a remote Git repository would call +$ curl -X POST localhost:8888/monitor -H 'X-GitHub-Event: push' -H 'X-Hub-Signature-256: sha256=' -d '{"commits":[{"modified":["order-service.yml"]}]}' +["order-service","order"] +HTTP 200 + +--- same webhook, wrong signature +HTTP 403 diff --git a/cloud-2026-upgrade/output/41-config-notify-class.txt b/cloud-2026-upgrade/output/41-config-notify-class.txt new file mode 100644 index 0000000..6d7bc28 --- /dev/null +++ b/cloud-2026-upgrade/output/41-config-notify-class.txt @@ -0,0 +1,31 @@ +# order-service reads shop.order.* from the config server. OrderProperties is a class with setters. + +--- before +$ curl localhost:8082/orders/config +{"currency":"EUR","maxQuantity":10} + +--- an unsigned request to /monitor (the curl most tutorials show) +$ curl -X POST localhost:8888/monitor -d path=order-service +HTTP 403 + +--- edit order-service.yml in the config repository: currency EUR -> USD, max-quantity 10 -> 3 +(no request sent: with a local file: repository the monitor module watches the directory itself) + +--- config server log +INFO o.s.c.c.m.FileMonitorConfiguration : Monitoring for local config changes: [run/config] +INFO o.s.c.c.monitor.PropertyPathEndpoint : Refresh for: order-service + +--- order-service log +INFO o.s.cloud.endpoint.RefreshEndpoint : Refreshed keys : [shop.order.currency, shop.order.max-quantity] + +--- what order-service uses after the refresh +$ curl localhost:8082/orders/config +{"currency":"USD","maxQuantity":3} + +--- a signed GitHub-style push webhook, the way a remote Git repository would call +$ curl -X POST localhost:8888/monitor -H 'X-GitHub-Event: push' -H 'X-Hub-Signature-256: sha256=' -d '{"commits":[{"modified":["order-service.yml"]}]}' +["order-service","order"] +HTTP 200 + +--- same webhook, wrong signature +HTTP 403 diff --git a/cloud-2026-upgrade/output/42-notifier-without-restclient.txt b/cloud-2026-upgrade/output/42-notifier-without-restclient.txt new file mode 100644 index 0000000..1d61b86 --- /dev/null +++ b/cloud-2026-upgrade/output/42-notifier-without-restclient.txt @@ -0,0 +1,4 @@ +# config-server with spring-cloud-config-monitor and the Eureka client, WITHOUT spring-boot-starter-restclient + +java.lang.IllegalStateException: At least one PropertyPathNotifier must be available +Error creating bean with name 'propertyPathEndpoint' diff --git a/cloud-2026-upgrade/output/43-native-multi-label.txt b/cloud-2026-upgrade/output/43-native-multi-label.txt new file mode 100644 index 0000000..c6767fa --- /dev/null +++ b/cloud-2026-upgrade/output/43-native-multi-label.txt @@ -0,0 +1,14 @@ +# a/app-prod.yml and b/app.yml both set demo.source. Request: /app/prod/a,b +# search-locations: file:/ (label directories are added automatically) + +=== Spring Cloud 2025.1.5 + wins from a/app-prod.yml + from b/app.yml + +=== Spring Cloud 2026.0.0 + wins from b/app.yml + from a/app-prod.yml + +=== Spring Cloud 2026.0.0 + spring.cloud.config.server.native.last-label-wins=false + wins from a/app-prod.yml + from b/app.yml diff --git a/cloud-2026-upgrade/output/50-forwarded-filters-ga.txt b/cloud-2026-upgrade/output/50-forwarded-filters-ga.txt new file mode 100644 index 0000000..82df0f7 --- /dev/null +++ b/cloud-2026-upgrade/output/50-forwarded-filters-ga.txt @@ -0,0 +1,12 @@ +== untrusted caller 203.0.113.9: Forwarded filter + Forwarded = [proto=http;for="203.0.113.9:40000"] + X-Forwarded-For = [198.51.100.7] + X-Forwarded-Proto= [https] +== untrusted caller 203.0.113.9: X-Forwarded filter + Forwarded = [for=198.51.100.7;proto=https] + X-Forwarded-For = [203.0.113.9] + X-Forwarded-Proto= [http] +== trusted caller 10.1.2.3: Forwarded filter + Forwarded = [proto=http;for="10.1.2.3:40000"] + X-Forwarded-For = [198.51.100.7] + X-Forwarded-Proto= [https] diff --git a/cloud-2026-upgrade/output/51-http-notifier-ga.txt b/cloud-2026-upgrade/output/51-http-notifier-ga.txt new file mode 100644 index 0000000..f6d040d --- /dev/null +++ b/cloud-2026-upgrade/output/51-http-notifier-ga.txt @@ -0,0 +1,9 @@ +== 1. changed applications: orders and ghost +WARN HttpPropertyPathNotifier -- Failed to notify instance http://127.0.0.1:1 +server received: POST /actuator/refresh +server received: POST /custom/refresh +requests received = 2 (3 instances registered for orders, one unreachable) +== 2. override the path per application +WARN HttpPropertyPathNotifier -- Failed to notify instance http://127.0.0.1:1 +server received: POST /internal/refresh +server received: POST /internal/refresh diff --git a/cloud-2026-upgrade/probes/gateway-webflux/pom.xml b/cloud-2026-upgrade/probes/gateway-webflux/pom.xml new file mode 100644 index 0000000..21858c1 --- /dev/null +++ b/cloud-2026-upgrade/probes/gateway-webflux/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + com.ankurm.upgrade + probe-gateway-webflux + 1.0.0 + + + + 4.2.0 + 2026.0.0 + 21 + UTF-8 + + + + + + org.springframework.bootspring-boot-dependencies + ${boot.version}pomimport + + + org.springframework.cloudspring-cloud-dependencies + ${cloud.version}pomimport + + + + + + + org.springframework.cloudspring-cloud-starter-gateway-server-webflux + + + + + + + org.apache.maven.pluginsmaven-dependency-plugin3.9.0 + packagecopy-dependencies + + + + diff --git a/cloud-2026-upgrade/probes/gateway-webflux/src/main/java/com/ankurm/upgrade/GatewayProbeApplication.java b/cloud-2026-upgrade/probes/gateway-webflux/src/main/java/com/ankurm/upgrade/GatewayProbeApplication.java new file mode 100644 index 0000000..af27024 --- /dev/null +++ b/cloud-2026-upgrade/probes/gateway-webflux/src/main/java/com/ankurm/upgrade/GatewayProbeApplication.java @@ -0,0 +1,12 @@ +package com.ankurm.upgrade; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** Nothing but the gateway; every route and switch is in application.yml or on the command line. */ +@SpringBootApplication +public class GatewayProbeApplication { + public static void main(String[] args) { + SpringApplication.run(GatewayProbeApplication.class, args); + } +} diff --git a/cloud-2026-upgrade/probes/gateway-webflux/src/main/resources/application.yml b/cloud-2026-upgrade/probes/gateway-webflux/src/main/resources/application.yml new file mode 100644 index 0000000..f295d20 --- /dev/null +++ b/cloud-2026-upgrade/probes/gateway-webflux/src/main/resources/application.yml @@ -0,0 +1,32 @@ +server: + port: 8090 +spring: + application: + name: probe-gateway-webflux + cloud: + gateway: + server: + webflux: + routes: + - id: headers + uri: http://127.0.0.1:9091 + predicates: + - Path=/headers + - id: flaky + uri: http://127.0.0.1:9091 + predicates: + - Path=/flaky + filters: + - name: Retry + args: + retries: 3 + statuses: INTERNAL_SERVER_ERROR + methods: GET + - id: count + uri: http://127.0.0.1:9091 + predicates: + - Path=/count + - id: ws + uri: ws://127.0.0.1:9091 + predicates: + - Path=/ws/** diff --git a/cloud-2026-upgrade/probes/gateway-webmvc/pom.xml b/cloud-2026-upgrade/probes/gateway-webmvc/pom.xml new file mode 100644 index 0000000..f7989e6 --- /dev/null +++ b/cloud-2026-upgrade/probes/gateway-webmvc/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + com.ankurm.upgrade + probe-gateway-webmvc + 1.0.0 + + + + 4.2.0 + 2026.0.0 + 21 + UTF-8 + + + + + + org.springframework.bootspring-boot-dependencies + ${boot.version}pomimport + + + org.springframework.cloudspring-cloud-dependencies + ${cloud.version}pomimport + + + + + + + org.springframework.cloudspring-cloud-starter-gateway-server-webmvc + + + + + + + org.apache.maven.pluginsmaven-dependency-plugin3.9.0 + packagecopy-dependencies + + + + diff --git a/cloud-2026-upgrade/probes/gateway-webmvc/src/main/java/com/ankurm/upgrade/GatewayProbeApplication.java b/cloud-2026-upgrade/probes/gateway-webmvc/src/main/java/com/ankurm/upgrade/GatewayProbeApplication.java new file mode 100644 index 0000000..af27024 --- /dev/null +++ b/cloud-2026-upgrade/probes/gateway-webmvc/src/main/java/com/ankurm/upgrade/GatewayProbeApplication.java @@ -0,0 +1,12 @@ +package com.ankurm.upgrade; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** Nothing but the gateway; every route and switch is in application.yml or on the command line. */ +@SpringBootApplication +public class GatewayProbeApplication { + public static void main(String[] args) { + SpringApplication.run(GatewayProbeApplication.class, args); + } +} diff --git a/cloud-2026-upgrade/probes/gateway-webmvc/src/main/resources/application.yml b/cloud-2026-upgrade/probes/gateway-webmvc/src/main/resources/application.yml new file mode 100644 index 0000000..b0a227c --- /dev/null +++ b/cloud-2026-upgrade/probes/gateway-webmvc/src/main/resources/application.yml @@ -0,0 +1,14 @@ +server: + port: 8090 +spring: + application: + name: probe-gateway-webmvc + cloud: + gateway: + server: + webmvc: + routes: + - id: headers + uri: http://127.0.0.1:9091 + predicates: + - Path=/headers diff --git a/cloud-2026-upgrade/probes/openfeign-querymap/pom.xml b/cloud-2026-upgrade/probes/openfeign-querymap/pom.xml new file mode 100644 index 0000000..4874699 --- /dev/null +++ b/cloud-2026-upgrade/probes/openfeign-querymap/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + com.ankurm.upgrade + probe-openfeign-querymap + 1.0.0 + + + 4.2.0 + 2026.0.0 + 21 + true + UTF-8 + + + + + + org.springframework.bootspring-boot-dependencies + ${boot.version}pomimport + + + org.springframework.cloudspring-cloud-dependencies + ${cloud.version}pomimport + + + + + + org.springframework.bootspring-boot-starter-webmvc + org.springframework.cloudspring-cloud-starter-openfeign + + + + + + org.apache.maven.pluginsmaven-dependency-plugin3.9.0 + packagecopy-dependencies + + + + diff --git a/cloud-2026-upgrade/probes/openfeign-querymap/src/main/java/com/ankurm/upgrade/QueryMapProbeApplication.java b/cloud-2026-upgrade/probes/openfeign-querymap/src/main/java/com/ankurm/upgrade/QueryMapProbeApplication.java new file mode 100644 index 0000000..9f62848 --- /dev/null +++ b/cloud-2026-upgrade/probes/openfeign-querymap/src/main/java/com/ankurm/upgrade/QueryMapProbeApplication.java @@ -0,0 +1,49 @@ +package com.ankurm.upgrade; + +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.cloud.openfeign.SpringQueryMap; +import org.springframework.context.annotation.Bean; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import jakarta.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Map; + +/** Sends a nested object through {@code @SpringQueryMap} to itself and prints the query string that arrived. */ +@SpringBootApplication +@EnableFeignClients +public class QueryMapProbeApplication { + + public record Price(Integer min, Integer max) { } + public record Filter(String text, Price price, List tags, Map attrs) { } + + @FeignClient(name = "search", url = "http://localhost:${server.port}") + public interface SearchClient { + @GetMapping("/search") + String search(@SpringQueryMap Filter filter); + } + + @RestController + static class Echo { + @GetMapping("/search") + String search(HttpServletRequest request) { + return java.net.URLDecoder.decode(String.valueOf(request.getQueryString()), java.nio.charset.StandardCharsets.UTF_8); + } + } + + @Bean + CommandLineRunner run(SearchClient client) { + return args -> { + var filter = new Filter("dock", new Price(10, 200), List.of("usb", "hub"), Map.of("colour", "black")); + System.out.println("RESULT query string received: " + client.search(filter)); + }; + } + + public static void main(String[] args) { + System.exit(SpringApplication.exit(SpringApplication.run(QueryMapProbeApplication.class, args))); + } +} diff --git a/cloud-2026-upgrade/probes/openfeign-querymap/src/main/resources/application.yml b/cloud-2026-upgrade/probes/openfeign-querymap/src/main/resources/application.yml new file mode 100644 index 0000000..8047e64 --- /dev/null +++ b/cloud-2026-upgrade/probes/openfeign-querymap/src/main/resources/application.yml @@ -0,0 +1 @@ +server.port: 8095 diff --git a/cloud-2026-upgrade/probes/preview-demos/pom.xml b/cloud-2026-upgrade/probes/preview-demos/pom.xml new file mode 100644 index 0000000..6afad76 --- /dev/null +++ b/cloud-2026-upgrade/probes/preview-demos/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + com.ankurm.upgrade + probe-preview-demos + 1.0.0 + + 21 + true + UTF-8 + + + + org.springframework.bootspring-boot-dependencies4.2.0pomimport + org.springframework.cloudspring-cloud-dependencies2026.0.0pomimport + + + + org.springframework.cloudspring-cloud-starter-gateway-server-webflux + org.springframework.cloudspring-cloud-config-monitor + org.springframework.bootspring-boot-starter-restclient + org.springframeworkspring-test + + + org.apache.maven.pluginsmaven-dependency-plugin3.9.0 + packagecopy-dependencies + + diff --git a/cloud-2026-upgrade/probes/preview-demos/src/main/java/ankurm/sc/ForwardedDemo.java b/cloud-2026-upgrade/probes/preview-demos/src/main/java/ankurm/sc/ForwardedDemo.java new file mode 100644 index 0000000..8e936d1 --- /dev/null +++ b/cloud-2026-upgrade/probes/preview-demos/src/main/java/ankurm/sc/ForwardedDemo.java @@ -0,0 +1,47 @@ +package ankurm.sc; + +import java.net.InetSocketAddress; + +import org.springframework.cloud.gateway.filter.headers.ForwardedHeadersFilter; +import org.springframework.cloud.gateway.filter.headers.XForwardedHeadersFilter; +import org.springframework.http.HttpHeaders; +import org.springframework.mock.http.server.reactive.MockServerHttpRequest; +import org.springframework.mock.web.server.MockServerWebExchange; + +/** + * Spring Cloud Gateway: what do the forwarded-header filters emit when the caller is NOT a trusted proxy and + * has sent its own Forwarded / X-Forwarded-For headers? Run on 5.0.3 (GA) and 5.1.0 (Paddington milestone). + */ +public class ForwardedDemo { + + static MockServerWebExchange exchange(String remote) { + MockServerHttpRequest request = MockServerHttpRequest.get("http://gateway.example/orders") + .remoteAddress(new InetSocketAddress(remote, 40000)) + .header("Forwarded", "for=198.51.100.7;proto=https") + .header("X-Forwarded-For", "198.51.100.7") + .header("X-Forwarded-Proto", "https") + .build(); + return MockServerWebExchange.from(request); + } + + static void print(String label, HttpHeaders h) { + System.out.println(label); + System.out.println(" Forwarded = " + h.get("Forwarded")); + System.out.println(" X-Forwarded-For = " + h.get("X-Forwarded-For")); + System.out.println(" X-Forwarded-Proto= " + h.get("X-Forwarded-Proto")); + } + + public static void main(String[] args) { + // Only 10.0.0.0/8 is trusted. The caller is 203.0.113.9, so its forwarded headers must not be believed. + String trusted = "10\\..*"; + ForwardedHeadersFilter forwarded = new ForwardedHeadersFilter(trusted); + XForwardedHeadersFilter xForwarded = new XForwardedHeadersFilter(trusted); + + MockServerWebExchange untrusted = exchange("203.0.113.9"); + print("== untrusted caller 203.0.113.9: Forwarded filter", forwarded.filter(untrusted.getRequest().getHeaders(), untrusted)); + MockServerWebExchange untrusted2 = exchange("203.0.113.9"); + print("== untrusted caller 203.0.113.9: X-Forwarded filter", xForwarded.filter(untrusted2.getRequest().getHeaders(), untrusted2)); + MockServerWebExchange ok = exchange("10.1.2.3"); + print("== trusted caller 10.1.2.3: Forwarded filter", forwarded.filter(ok.getRequest().getHeaders(), ok)); + } +} diff --git a/cloud-2026-upgrade/probes/preview-demos/src/main/java/ankurm/sc/HttpNotifierDemo.java b/cloud-2026-upgrade/probes/preview-demos/src/main/java/ankurm/sc/HttpNotifierDemo.java new file mode 100644 index 0000000..6f54f14 --- /dev/null +++ b/cloud-2026-upgrade/probes/preview-demos/src/main/java/ankurm/sc/HttpNotifierDemo.java @@ -0,0 +1,62 @@ +package ankurm.sc; + +import java.net.InetSocketAddress; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArrayList; + +import com.sun.net.httpserver.HttpServer; + +import org.springframework.cloud.client.DefaultServiceInstance; +import org.springframework.cloud.client.ServiceInstance; +import org.springframework.cloud.client.discovery.DiscoveryClient; +import org.springframework.cloud.config.monitor.HttpPropertyPathNotifier; +import org.springframework.cloud.config.monitor.MonitorConfigurationProperties; +import org.springframework.web.client.RestClient; + +/** + * Spring Cloud Config 5.1.0: what does HttpPropertyPathNotifier send when Config Server sees "orders" changed? + * A JDK HttpServer plays the client application; a stub DiscoveryClient says where it lives. + */ +public class HttpNotifierDemo { + + public static void main(String[] args) throws Exception { + List received = new CopyOnWriteArrayList<>(); + HttpServer server = HttpServer.create(new InetSocketAddress("127.0.0.1", 0), 0); + server.createContext("/", ex -> { + received.add(ex.getRequestMethod() + " " + ex.getRequestURI()); + ex.sendResponseHeaders(204, -1); + ex.close(); + }); + server.start(); + int port = server.getAddress().getPort(); + + DefaultServiceInstance defaultPath = new DefaultServiceInstance("i1", "orders", "127.0.0.1", port, false); + DefaultServiceInstance metaPath = new DefaultServiceInstance("i2", "orders", "127.0.0.1", port, false, + Map.of("refresh-endpoint", "/custom/refresh")); + DefaultServiceInstance dead = new DefaultServiceInstance("i3", "orders", "127.0.0.1", 1, false); + DiscoveryClient discovery = new DiscoveryClient() { + public String description() { return "stub"; } + public List getInstances(String id) { + return "orders".equals(id) ? List.of(defaultPath, metaPath, dead) : List.of(); + } + public List getServices() { return List.of("orders"); } + }; + + MonitorConfigurationProperties props = new MonitorConfigurationProperties(); + HttpPropertyPathNotifier notifier = new HttpPropertyPathNotifier(discovery, RestClient.builder().build(), props); + + System.out.println("== 1. changed applications: orders and ghost"); + notifier.notifyApplications(Set.of("orders", "ghost")); + received.stream().sorted().forEach(r -> System.out.println("server received: " + r)); + System.out.println("requests received = " + received.size() + " (3 instances registered for orders, one unreachable)"); + + System.out.println("== 2. override the path per application"); + received.clear(); + props.getHttp().setEndpoints(Map.of("orders", "/internal/refresh")); + notifier.notifyApplications(Set.of("orders")); + received.stream().sorted().forEach(r -> System.out.println("server received: " + r)); + server.stop(0); + } +} diff --git a/cloud-2026-upgrade/probes/reactor-extra/pom.xml b/cloud-2026-upgrade/probes/reactor-extra/pom.xml new file mode 100644 index 0000000..77a8ba3 --- /dev/null +++ b/cloud-2026-upgrade/probes/reactor-extra/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + com.ankurm.upgrade + probe-reactor-extra + 1.0.0 + + + 4.2.0 + 2026.0.0 + 21 + UTF-8 + + + + + + org.springframework.bootspring-boot-dependencies + ${boot.version}pomimport + + + org.springframework.cloudspring-cloud-dependencies + ${cloud.version}pomimport + + + + + + + org.springframework.cloudspring-cloud-starter-loadbalancer + + diff --git a/cloud-2026-upgrade/probes/reactor-extra/src/main/java/com/ankurm/upgrade/UsesReactorExtra.java b/cloud-2026-upgrade/probes/reactor-extra/src/main/java/com/ankurm/upgrade/UsesReactorExtra.java new file mode 100644 index 0000000..d2cf12a --- /dev/null +++ b/cloud-2026-upgrade/probes/reactor-extra/src/main/java/com/ankurm/upgrade/UsesReactorExtra.java @@ -0,0 +1,10 @@ +package com.ankurm.upgrade; + +import reactor.retry.Repeat; + +/** Compiles on 2025.1.x only because spring-cloud-loadbalancer happened to pull reactor-extra in. */ +public class UsesReactorExtra { + public Object repeatThreeTimes() { + return Repeat.times(3); + } +} diff --git a/cloud-2026-upgrade/scripts/Echo.java b/cloud-2026-upgrade/scripts/Echo.java new file mode 100644 index 0000000..f77d7b6 --- /dev/null +++ b/cloud-2026-upgrade/scripts/Echo.java @@ -0,0 +1,43 @@ +import com.sun.net.httpserver.HttpServer; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.util.Locale; +import java.util.TreeMap; +import java.util.concurrent.atomic.AtomicInteger; + +/** A dependency-free backend for the gateway probes. Run with: java scripts/Echo.java 9091 */ +public class Echo { + public static void main(String[] args) throws IOException { + AtomicInteger flaky = new AtomicInteger(); + HttpServer server = HttpServer.create(new InetSocketAddress("127.0.0.1", Integer.parseInt(args[0])), 0); + + // Prints the forwarding headers exactly as they arrived, so we see what the gateway sent upstream. + server.createContext("/headers", ex -> { + var found = new TreeMap(); + ex.getRequestHeaders().forEach((name, values) -> { + String n = name.toLowerCase(Locale.ROOT); + if (n.equals("forwarded") || n.startsWith("x-forwarded")) found.put(n, String.join(" | ", values)); + }); + StringBuilder body = new StringBuilder(); + found.forEach((k, v) -> body.append(k).append(": ").append(v.replaceAll("127\\.0\\.0\\.1:\\d+", "127.0.0.1:")).append('\n')); + if (found.isEmpty()) body.append("(no Forwarded or X-Forwarded-* header at all)\n"); + reply(ex, 200, body.toString()); + }); + // Always 500, and counts how often it was called. + server.createContext("/flaky", ex -> { + flaky.incrementAndGet(); + reply(ex, 500, "boom\n"); + }); + server.createContext("/count", ex -> reply(ex, 200, "upstream calls to /flaky: " + flaky.getAndSet(0) + "\n")); + server.start(); + System.out.println("echo on " + args[0]); + } + + private static void reply(com.sun.net.httpserver.HttpExchange ex, int status, String body) throws IOException { + byte[] bytes = body.getBytes(); + ex.getResponseHeaders().add("Content-Type", "text/plain"); + ex.sendResponseHeaders(status, bytes.length); + ex.getResponseBody().write(bytes); + ex.close(); + } +} diff --git a/cloud-2026-upgrade/scripts/bom-diff.py b/cloud-2026-upgrade/scripts/bom-diff.py new file mode 100644 index 0000000..37dcf10 --- /dev/null +++ b/cloud-2026-upgrade/scripts/bom-diff.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +"""List what the spring-cloud-dependencies BOM manages in two release trains and print the difference. +Usage: bom-diff.py OLD NEW (e.g. bom-diff.py 2025.1.5 2026.0.0). Set MAVEN_REPO to use another repository.""" +import os, re, sys, time, urllib.request +import xml.etree.ElementTree as ET +REPO = os.environ.get("MAVEN_REPO", "https://repo1.maven.org/maven2").rstrip("/") +NS = "{http://maven.apache.org/POM/4.0.0}" +cache = {} + +def pom(g, a, v): + key = (g, a, v) + if key not in cache: + url = f"{REPO}/{g.replace('.', '/')}/{a}/{v}/{a}-{v}.pom" + for attempt in range(5): + try: + cache[key] = ET.fromstring(urllib.request.urlopen(url, timeout=30).read()); break + except Exception: + if attempt == 4: raise + time.sleep(5 * (attempt + 1)) + return cache[key] + +def managed(g, a, v, props=None, out=None): + """Collect groupId:artifactId -> version from a BOM, following imported BOMs and the parent POM's properties.""" + out = {} if out is None else out + root = pom(g, a, v) + p = {} + parent = root.find(NS + "parent") + chain = [] + while parent is not None: + pr = pom(*(parent.findtext(NS + k) for k in ("groupId", "artifactId", "version"))) + chain.append(pr); parent = pr.find(NS + "parent") + for doc in reversed(chain): + for e in doc.findall(NS + "properties/*"): p[e.tag.replace(NS, "")] = (e.text or "").strip() + for e in root.findall(NS + "properties/*"): p[e.tag.replace(NS, "")] = (e.text or "").strip() + p.update(props or {}) + p["project.version"] = v; p["project.groupId"] = g + def sub(s): + for _ in range(5): s = re.sub(r"\$\{([^}]+)\}", lambda m: p.get(m.group(1), m.group(0)), s) + return s + for d in root.findall(f"{NS}dependencyManagement/{NS}dependencies/{NS}dependency"): + dg, da, dv = (sub(d.findtext(NS + k, "").strip()) for k in ("groupId", "artifactId", "version")) + if d.findtext(NS + "scope") == "import": + managed(dg, da, dv, None, out) + elif dg.startswith("org.springframework.cloud"): + out.setdefault(f"{dg}:{da}", dv) + return out + +old, new = sys.argv[1], sys.argv[2] +o = managed("org.springframework.cloud", "spring-cloud-dependencies", old) +n = managed("org.springframework.cloud", "spring-cloud-dependencies", new) +print(f"# org.springframework.cloud artifacts managed by spring-cloud-dependencies {old} vs {new}") +print(f"managed in {old}: {len(o)} managed in {new}: {len(n)}") +for title, keys, src in (("REMOVED", sorted(set(o) - set(n)), o), ("ADDED", sorted(set(n) - set(o)), n)): + print(f"\n{title} ({len(keys)})") + for k in keys: + print(f" {k}:{src[k]}") + if title == "REMOVED": + g, a = k.split(":") + try: pom(g, a, src[k]); print(" (that version's POM is published)") + except Exception as e: print(f" (but that version's POM is NOT in the repository: {getattr(e, 'code', e)})") diff --git a/cloud-2026-upgrade/scripts/collect-shop.sh b/cloud-2026-upgrade/scripts/collect-shop.sh new file mode 100755 index 0000000..7a10f40 --- /dev/null +++ b/cloud-2026-upgrade/scripts/collect-shop.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Compare the shop scenario output of the patched 4.1 line (step 1) with the final upgrade (step 5). +cd "$(dirname "$0")/.." || exit 1 +norm() { sed -E 's/"timestamp":"[^"]+"/"timestamp":""/g; s/[0-9a-f]{32}-[0-9a-f]{16}/-/g; s/[0-9a-f]{32}//g' "$1"; } +F=output/11-shop-before-after.txt +{ echo "# The shop's scenario files, compared with Boot 4.1.3 / 2025.1.5 (timestamps and trace ids masked)." + echo "# 00-startup-race.txt is left out: it records timing." + for step in "2 only the two version numbers changed (step 2)" "5 all five steps applied"; do + read -r n title <<<"$step" + echo; echo "=== Boot 4.2.0 / 2026.0.0, $title" + for f in 01-config-server 02-eureka-registry 03-gateway-requests 04-trace-propagation 05-circuit-breaker 06-eureka-lb-trap; do + if diff -q <(norm run/shop1/output/$f.txt) <(norm run/shop$n/output/$f.txt) >/dev/null; then echo "$f.txt: identical" + else echo "$f.txt: DIFFERENT"; diff <(norm run/shop1/output/$f.txt) <(norm run/shop$n/output/$f.txt) | grep '^[<>]' | grep -v '^[<>] *$' | cut -c1-110 | head -6 | sed 's/^/ /'; fi + done + done; } > $F +cp run/shop1/output/06-eureka-lb-trap.txt output/12-eureka-lb-trap-before.txt +# On 2026.0.0 the log is the evidence: the registry query in gotchas.sh can answer from Eureka's 30 s response cache. +L=run/shop2/run/logs/order-service-broken.log +{ echo "# order-service on 2026.0.0 with --shop.demo.primary-builder=false, taken from its own log" + echo + echo "lines with BeanCurrentlyInCreationException: $(grep -c BeanCurrentlyInCreationException $L)" + echo "lines with 'No instances available for localhost': $(grep -c 'No instances available for localhost' $L)" + grep -m1 -E 'registration status' $L | sed -E 's/^.*(DiscoveryClient_ORDER)/\1/' +} > output/13-eureka-lb-trap-after.txt +{ echo; echo "The yes/no registry line in 06-eureka-lb-trap.txt varies between runs on 2026.0.0 (Eureka caches that answer);" + echo "the registration itself is recorded in 13-eureka-lb-trap-after.txt."; } >> $F +cp run/shop5/output/03-gateway-requests.txt output/14-gateway-requests-after.txt +cat $F output/1[23]-*.txt diff --git a/cloud-2026-upgrade/scripts/config-notify.sh b/cloud-2026-upgrade/scripts/config-notify.sh new file mode 100755 index 0000000..ea7629b --- /dev/null +++ b/cloud-2026-upgrade/scripts/config-notify.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# Steps 4 and 5 on a running shop: change a value in the config repository and watch what refreshes. +# $1 = directory produced by `upgrade.sh 4` (or 5) and built. $2 = output file name inside output/ +MOD=$(cd "$(dirname "$0")/.." && pwd) +cd "$1" || exit 1 +unset JAVA_TOOL_OPTIONS +F=$MOD/output/$2 +SECRET=demo-secret +rm -rf run; mkdir -p run/logs; cp -r config-server/src/main/resources/config run/config +trap 'scripts/stop.sh >/dev/null' EXIT +start() { # service port extra... + local name=$1 port=$2; shift 2 + nohup java -Xmx200m -XX:+UseSerialGC -jar "$name/target/$name-1.0.0.jar" "$@" > "run/logs/$name.log" 2>&1 & + echo $! > "run/$name.pid" + for _ in $(seq 1 90); do curl -fs "localhost:$port/actuator/health" >/dev/null 2>&1 && return; sleep 1; done + echo "$name did not come up" >&2; tail -30 "run/logs/$name.log" >&2; exit 1 +} +start config-server 8888 "--spring.cloud.config.server.native.search-locations=file:$PWD/run/config/" \ + "--spring.cloud.config.server.monitor.github.webhook-secret=$SECRET" +start discovery-server 8761 +start product-service 8081 +start inventory-service 8083 +start order-service 8082 +for _ in $(seq 1 60); do + curl -s -H 'Accept: application/json' localhost:8761/eureka/apps | grep -q 'order-service:8082' && break; sleep 2 +done +sleep 35 # the config server's Eureka client fetches the registry every 30 s +show() { echo "\$ curl localhost:$1$2"; curl -s "localhost:$1$2"; echo; } +{ + echo "# order-service reads shop.order.* from the config server. $(grep -qE '^record' order-service/src/main/java/com/ankurm/shop/order/OrderProperties.java && echo 'OrderProperties is a Java record.' || echo 'OrderProperties is a class with setters.')" + echo; echo "--- before"; show 8082 /orders/config + echo; echo "--- an unsigned request to /monitor (the curl most tutorials show)" + echo "\$ curl -X POST localhost:8888/monitor -d path=order-service" + curl -s -o /dev/null -w 'HTTP %{http_code}\n' -X POST localhost:8888/monitor -d path=order-service + echo; echo "--- edit order-service.yml in the config repository: currency EUR -> USD, max-quantity 10 -> 3" + printf 'shop:\n order:\n currency: USD\n max-quantity: 3\n' > run/config/order-service.yml + sleep 12 + echo "(no request sent: with a local file: repository the monitor module watches the directory itself)" + echo; echo "--- config server log" + grep -hE 'Monitoring for local|Refresh for: order-service|Failed to notify' run/logs/config-server.log | sed -E 's/^[^ ]+ +([A-Z]+) [0-9]+ --- (\[[^]]*\] )+/\1 /' | sed "s#$PWD/##" | head -4 + echo; echo "--- order-service log" + grep -hE 'Refreshed keys' run/logs/order-service.log | sed -E 's/^[^ ]+ +([A-Z]+) [0-9]+ --- (\[[^]]*\] )+/\1 /' | tail -1 + echo; echo "--- what order-service uses after the refresh"; show 8082 /orders/config + echo; echo "--- a signed GitHub-style push webhook, the way a remote Git repository would call" + BODY='{"commits":[{"modified":["order-service.yml"]}]}' + SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" | sed 's/^.* //') + echo "\$ curl -X POST localhost:8888/monitor -H 'X-GitHub-Event: push' -H 'X-Hub-Signature-256: sha256=' -d '$BODY'" + curl -s -w '\nHTTP %{http_code}\n' -X POST localhost:8888/monitor -H 'Content-Type: application/json' -H 'X-GitHub-Event: push' -H "X-Hub-Signature-256: sha256=$SIG" -d "$BODY" + echo; echo "--- same webhook, wrong signature" + curl -s -o /dev/null -w 'HTTP %{http_code}\n' -X POST localhost:8888/monitor -H 'Content-Type: application/json' -H 'X-GitHub-Event: push' -H "X-Hub-Signature-256: sha256=0000" -d "$BODY" +} > "$F" +cat "$F" diff --git a/cloud-2026-upgrade/scripts/dependency-diff.sh b/cloud-2026-upgrade/scripts/dependency-diff.sh new file mode 100755 index 0000000..b57ea00 --- /dev/null +++ b/cloud-2026-upgrade/scripts/dependency-diff.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# What actually changes on the classpath of the six services. Writes output/15-dependency-diff.txt +MOD=$(cd "$(dirname "$0")/.." && pwd); cd "$MOD" || exit 1 +for s in 1 5; do + (cd run/shop$s && mvn -B -q dependency:list -DoutputFile=deps.txt ${MVN_ARGS:-} >/dev/null) + cat run/shop$s/*/deps.txt | grep -oE '^ +[a-z][^ ]+' | sed 's/ //g' | awk -F: '{print $1":"$2" "$(NF-1)}' | sort -u > run/deps$s.txt +done +{ echo "# Libraries of the six services: Boot 4.1.3 / 2025.1.5 -> Boot 4.2.0 / 2026.0.0 (selected groups)" + python3 -I - <<'P' +import collections +def load(n): + d=collections.defaultdict(set) + for l in open(f'run/deps{n}.txt'): + k,v=l.split(); d[k].add(v) + return d +a,b=load(1),load(5) +want=('org.springframework.cloud:','io.github.resilience4j:','io.projectreactor','org.jetbrains','org.springframework:spring-core','org.springframework.boot:spring-boot ','io.micrometer:micrometer-core','org.eclipse.jgit:org.eclipse.jgit') +for k in sorted(set(a)|set(b)): + if not any((k+' ').startswith(w) for w in want): continue + o,n=','.join(sorted(a.get(k,[]))) or '(absent)', ','.join(sorted(b.get(k,[]))) or '(gone)' + if o!=n: print(f'{k:62} {o:10} -> {n}') +P +} > output/15-dependency-diff.txt +cat output/15-dependency-diff.txt diff --git a/cloud-2026-upgrade/scripts/half-upgrades.sh b/cloud-2026-upgrade/scripts/half-upgrades.sh new file mode 100755 index 0000000..05f5455 --- /dev/null +++ b/cloud-2026-upgrade/scripts/half-upgrades.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Bump only one of the two version numbers and capture what the config server says. Writes output/10-half-upgrades.txt +MOD=$(cd "$(dirname "$0")/.." && pwd); cd "$MOD" || exit 1 +unset JAVA_TOOL_OPTIONS +F=output/10-half-upgrades.txt; : > $F +for pair in "shopbootonly Boot 4.2.0 with Spring Cloud 2025.1.5" "shopcloudonly Boot 4.1.3 with Spring Cloud 2026.0.0"; do + read -r dir title <<<"$pair" + mkdir -p run/$dir/run/logs + (cd run/$dir && timeout 60 java -Xmx200m -jar config-server/target/config-server-1.0.0.jar > run/logs/config-server.log 2>&1) + { echo "=== $title"; sed -n '/APPLICATION FAILED TO START/,/spring.cloud.compatibility-verifier.enabled=false/p' run/$dir/run/logs/config-server.log | grep -v '^\s*$'; echo; } >> $F +done +cat $F diff --git a/cloud-2026-upgrade/scripts/native-labels.sh b/cloud-2026-upgrade/scripts/native-labels.sh new file mode 100755 index 0000000..bdcb687 --- /dev/null +++ b/cloud-2026-upgrade/scripts/native-labels.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Native config repository asked for two labels at once ("a,b"): which one wins on each train? +# $1 = built copy on 2025.1.5 (upgrade.sh 1), $2 = built copy on 2026.0.0 (upgrade.sh 2) +MOD=$(cd "$(dirname "$0")/.." && pwd); cd "$MOD" || exit 1 +unset JAVA_TOOL_OPTIONS +repo=run/labels; mkdir -p $repo/a $repo/b +echo 'demo.source: from a/app-prod.yml' > $repo/a/app-prod.yml +echo 'demo.source: from b/app.yml' > $repo/b/app.yml +F=output/43-native-multi-label.txt +{ echo "# a/app-prod.yml and b/app.yml both set demo.source. Request: /app/prod/a,b" + echo "# search-locations: file:/ (label directories are added automatically)"; } > $F +ask() { # title dir extra... + local title=$1 dir=$2; shift 2 + java -Xmx200m -jar "$dir/config-server/target/config-server-1.0.0.jar" \ + "--spring.cloud.config.server.native.search-locations=file:$MOD/$repo/" "$@" > run/labels.log 2>&1 & + local pid=$! + for _ in $(seq 1 60); do curl -fs localhost:8888/actuator/health >/dev/null 2>&1 && break; sleep 1; done + { echo; echo "=== $title"; curl -s localhost:8888/app/prod/a,b | python3 -I -c 'import sys,json +for i,ps in enumerate(json.load(sys.stdin)["propertySources"]): + print(" ", "wins " if i==0 else " ", ps["source"].get("demo.source"))'; } >> $F + kill $pid; wait $pid 2>/dev/null +} +ask "Spring Cloud 2025.1.5" "$1" +ask "Spring Cloud 2026.0.0" "$2" +ask "Spring Cloud 2026.0.0 + spring.cloud.config.server.native.last-label-wins=false" "$2" --spring.cloud.config.server.native.last-label-wins=false +cat $F diff --git a/cloud-2026-upgrade/scripts/notify-without-restclient.sh b/cloud-2026-upgrade/scripts/notify-without-restclient.sh new file mode 100755 index 0000000..e745446 --- /dev/null +++ b/cloud-2026-upgrade/scripts/notify-without-restclient.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# The config server with config-monitor and Eureka but no RestClient.Builder bean. $1 = built copy without spring-boot-starter-restclient. +MOD=$(cd "$(dirname "$0")/.." && pwd); cd "$1" || exit 1 +unset JAVA_TOOL_OPTIONS +mkdir -p run/logs +timeout 60 java -Xmx200m -jar config-server/target/config-server-1.0.0.jar > run/logs/config-server.log 2>&1 +{ echo "# config-server with spring-cloud-config-monitor and the Eureka client, WITHOUT spring-boot-starter-restclient" + echo + grep -m1 -oE 'java.lang.IllegalStateException: At least one PropertyPathNotifier[^\n]*' run/logs/config-server.log + grep -m1 -E "Error creating bean with name 'propertyPathEndpoint'" run/logs/config-server.log | grep -oE "Error creating bean with name 'propertyPathEndpoint'" +} > "$MOD/output/42-notifier-without-restclient.txt" +cat "$MOD/output/42-notifier-without-restclient.txt" diff --git a/cloud-2026-upgrade/scripts/preview-demos.sh b/cloud-2026-upgrade/scripts/preview-demos.sh new file mode 100755 index 0000000..b4aa86b --- /dev/null +++ b/cloud-2026-upgrade/scripts/preview-demos.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# The two class-level demos from the preview article, re-run on the GA jars (Boot 4.2.0 / Spring Cloud 2026.0.0). +set -uo pipefail +cd "$(dirname "$0")/.." +mvn -B -q -f probes/preview-demos/pom.xml clean package ${MVN_ARGS:-} >/dev/null || exit 1 +CP='probes/preview-demos/target/classes:probes/preview-demos/target/dependency/*' +clean() { grep -vE 'Picked up|DEBUG|^\s+at |^\s+\.\.\.|^org\.spring|^Caused by' | sed -E 's/^[0-9:.]+ \[main\] WARN org\.springframework\.cloud\.config\.monitor\./WARN /'; } +for pair in "ForwardedDemo 50-forwarded-filters-ga" "HttpNotifierDemo 51-http-notifier-ga"; do + read -r main file <<<"$pair" + env -u JAVA_TOOL_OPTIONS java -cp "$CP" ankurm.sc.$main 2>&1 | clean > output/$file.txt + cat output/$file.txt +done diff --git a/cloud-2026-upgrade/scripts/probe-gateway.sh b/cloud-2026-upgrade/scripts/probe-gateway.sh new file mode 100755 index 0000000..76e6fce --- /dev/null +++ b/cloud-2026-upgrade/scripts/probe-gateway.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +# Same two gateway apps, three release trains, three trusted-proxy settings. Writes output/20-*.txt ... 23-*.txt +set -uo pipefail +cd "$(dirname "$0")/.." +TRAINS=("4.1.3 2025.1.3" "4.1.3 2025.1.5" "4.2.0 2026.0.0") + +build() { # flavour boot cloud + local dir=run/probe-$1-$3 + [ -d "$dir/dependency" ] && return + mvn -B -q -f probes/gateway-$1/pom.xml -Dboot.version=$2 -Dcloud.version=$3 clean package ${MVN_ARGS:-} >/dev/null || exit 1 + mkdir -p "$dir"; cp -r probes/gateway-$1/target/classes probes/gateway-$1/target/dependency "$dir/" +} +if [ "${1:-}" = "--build" ]; then + for t in "${TRAINS[@]}"; do read -r boot cloud <<<"$t"; build webmvc $boot $cloud; build webflux $boot $cloud; done + exit 0 +fi + +unset JAVA_TOOL_OPTIONS # only for the runs: Maven above may need it +start_gw() { # flavour cloud extra-args... + local flavour=$1 cloud=$2; shift 2 + java -Xmx200m -XX:+UseSerialGC -cp "run/probe-$flavour-$cloud/classes:run/probe-$flavour-$cloud/dependency/*" \ + com.ankurm.upgrade.GatewayProbeApplication "$@" > run/probe.log 2>&1 & + GW=$! + for _ in $(seq 1 60); do curl -s -o /dev/null localhost:8090/ && return; sleep 1; done + echo "gateway did not start" >&2; tail -20 run/probe.log >&2; exit 1 +} +stop_gw() { kill $GW; wait $GW 2>/dev/null; } + +java scripts/Echo.java 9091 > run/echo.log 2>&1 & ECHO=$! +trap 'kill $ECHO 2>/dev/null' EXIT +for _ in $(seq 1 30); do curl -s -o /dev/null localhost:9091/headers && break; sleep 1; done + +FORGED=(-H 'Forwarded: for=198.51.100.7;proto=https' -H 'X-Forwarded-For: 198.51.100.7' -H 'X-Forwarded-Proto: https') + +n=20 +for flavour in webmvc webflux; do + F=output/$n-trusted-proxies-$flavour.txt; : > $F + { echo "# Gateway Server $flavour. The client is 127.0.0.1 and sends forged headers:" + echo "# Forwarded: for=198.51.100.7;proto=https X-Forwarded-For: 198.51.100.7 X-Forwarded-Proto: https" + echo "# Below: the forwarding headers the backend actually received."; } >> $F + for t in "${TRAINS[@]}"; do + read -r boot cloud <<<"$t" + for setting in unset '10\..*' '127\.0\.0\.1'; do + args=() + [ "$setting" != unset ] && args=("--spring.cloud.gateway.server.$flavour.trusted-proxies=$setting") + start_gw $flavour $cloud "${args[@]}" + case "$setting" in unset) label="trusted-proxies not set";; '10\..*') label="trusted-proxies=$setting (caller NOT trusted)";; *) label="trusted-proxies=$setting (caller trusted)";; esac + { echo; echo "=== Boot $boot / Spring Cloud $cloud | $label"; curl -s "${FORGED[@]}" localhost:8090/headers; } >> $F + stop_gw + done + done + n=$((n+1)) +done + +# Behind a load balancer: the peer (127.0.0.1) plays the balancer and reports the real client, 203.0.113.50. +H=output/24-behind-load-balancer.txt; : > $H +echo "# 127.0.0.1 plays a load balancer. It sends: X-Forwarded-For: 203.0.113.50 Forwarded: for=203.0.113.50;proto=https" >> $H +echo "# 203.0.113.50 is the real client. Does it survive the gateway?" >> $H +LB=(-H 'X-Forwarded-For: 203.0.113.50' -H 'Forwarded: for=203.0.113.50;proto=https') +for flavour in webmvc webflux; do + for t in "${TRAINS[@]}"; do + read -r boot cloud <<<"$t" + for setting in '127\.0\.0\.1' '127\.0\.0\.1|203\.0\.113\.50'; do + start_gw $flavour $cloud "--spring.cloud.gateway.server.$flavour.trusted-proxies=$setting" + { echo; echo "=== $flavour | Spring Cloud $cloud | trusted-proxies=$setting"; curl -s "${LB[@]}" localhost:8090/headers | grep -E '^(x-forwarded-for|forwarded):'; } >> $H + stop_gw + done + done +done + +F=output/22-retry-filter-webflux.txt; : > $F +echo "# WebFlux gateway, Retry filter (retries: 3, statuses: INTERNAL_SERVER_ERROR) in front of a backend that always answers 500." >> $F +G=output/23-websocket-origin-webflux.txt; : > $G +echo "# WebFlux gateway with a ws:// route. A handshake with a foreign Origin header." >> $G +echo "# The backend is a plain HTTP server, so a handshake the gateway lets through fails further down." >> $G +for t in "${TRAINS[@]}"; do + read -r boot cloud <<<"$t" + start_gw webflux $cloud + curl -s -o /dev/null localhost:8090/count + { echo; echo "=== Boot $boot / Spring Cloud $cloud" + echo "client status: $(curl -s -o /dev/null -w '%{http_code}' localhost:8090/flaky)" + curl -s localhost:8090/count; } >> $F + { echo; echo "=== Boot $boot / Spring Cloud $cloud" + curl -s -i --max-time 5 -H 'Connection: Upgrade' -H 'Upgrade: websocket' -H 'Sec-WebSocket-Version: 13' \ + -H 'Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==' -H 'Origin: https://evil.example' localhost:8090/ws/chat | head -1 | tr -d '\r' + echo; } >> $G + stop_gw +done +cat output/22*.txt output/23*.txt output/24*.txt diff --git a/cloud-2026-upgrade/scripts/probe-libs.sh b/cloud-2026-upgrade/scripts/probe-libs.sh new file mode 100755 index 0000000..1bca501 --- /dev/null +++ b/cloud-2026-upgrade/scripts/probe-libs.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# OpenFeign @SpringQueryMap and the vanished reactor-extra dependency, on the old and new train. +set -uo pipefail +cd "$(dirname "$0")/.." +mkdir -p run output +F=output/30-openfeign-querymap.txt; : > $F +echo "# A record with a nested record, a list and a map, sent with @SpringQueryMap. What the server received (URL-decoded)." >> $F +G=output/31-reactor-extra.txt; : > $G +echo "# A class that imports reactor.retry.Repeat in a project that declares only spring-cloud-starter-loadbalancer." >> $G +for t in "4.1.3 2025.1.5" "4.2.0 2026.0.0"; do + read -r boot cloud <<<"$t" + mvn -B -q -f probes/openfeign-querymap/pom.xml -Dboot.version=$boot -Dcloud.version=$cloud clean package ${MVN_ARGS:-} >/dev/null || exit 1 + { echo; echo "=== Boot $boot / Spring Cloud $cloud" + java -Xmx200m -cp "probes/openfeign-querymap/target/classes:probes/openfeign-querymap/target/dependency/*" \ + com.ankurm.upgrade.QueryMapProbeApplication --spring.main.banner-mode=off 2>&1 | grep -E '^RESULT' | sed 's/^RESULT //' + ls probes/openfeign-querymap/target/dependency | grep -E '^feign-core|^spring-cloud-openfeign-core'; } >> $F + if [ $cloud = 2026.0.0 ]; then + { echo; echo "=== Boot $boot / Spring Cloud $cloud + spring.cloud.openfeign.client.config.default.nested-query-map-enabled=true" + java -Xmx200m -cp "probes/openfeign-querymap/target/classes:probes/openfeign-querymap/target/dependency/*" \ + com.ankurm.upgrade.QueryMapProbeApplication --spring.main.banner-mode=off \ + --spring.cloud.openfeign.client.config.default.nested-query-map-enabled=true 2>&1 | grep -E '^RESULT' | sed 's/^RESULT //'; } >> $F + fi + { echo; echo "=== Boot $boot / Spring Cloud $cloud" + if out=$(mvn -B -q -f probes/reactor-extra/pom.xml -Dboot.version=$boot -Dcloud.version=$cloud clean compile ${MVN_ARGS:-} 2>&1); then + echo "compiles" + else + echo "$out" | grep -E '^\[ERROR\] .*\.java' | head -3 | sed "s#$PWD/##" + fi; } >> $G +done +cat $F $G diff --git a/cloud-2026-upgrade/scripts/props-diff.py b/cloud-2026-upgrade/scripts/props-diff.py new file mode 100644 index 0000000..294ac7d --- /dev/null +++ b/cloud-2026-upgrade/scripts/props-diff.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +"""Diff spring-configuration-metadata.json of Spring Cloud jars between 2025.1.5 and 2026.0.0. +Usage: props-diff.py (set MAVEN_REPO to use another repository)""" +import io, json, os, time, urllib.request, zipfile +REPO = os.environ.get("MAVEN_REPO", "https://repo1.maven.org/maven2").rstrip("/") +ARTIFACTS = [ # artifactId, version in 2025.1.5, version in 2026.0.0 + ("spring-cloud-commons", "5.0.5", "5.1.0"), ("spring-cloud-context", "5.0.5", "5.1.0"), + ("spring-cloud-loadbalancer", "5.0.5", "5.1.0"), + ("spring-cloud-config-client", "5.0.7", "5.1.0"), ("spring-cloud-config-server", "5.0.7", "5.1.0"), + ("spring-cloud-config-monitor", "5.0.7", "5.1.0"), + ("spring-cloud-gateway-server-webflux", "5.0.5", "5.1.0"), ("spring-cloud-gateway-server-webmvc", "5.0.5", "5.1.0"), + ("spring-cloud-openfeign-core", "5.0.4", "5.1.0"), ("spring-cloud-stream", "5.0.5", "5.1.0"), + ("spring-cloud-netflix-eureka-client", "5.0.4", "5.1.0"), ("spring-cloud-netflix-eureka-server", "5.0.4", "5.1.0"), + ("spring-cloud-circuitbreaker-resilience4j", "5.0.3", "5.1.0"), +] + +def props(a, v): + url = f"{REPO}/org/springframework/cloud/{a}/{v}/{a}-{v}.jar" + for attempt in range(5): + try: + data = urllib.request.urlopen(url, timeout=60).read(); break + except Exception: + if attempt == 4: raise + time.sleep(5 * (attempt + 1)) + out = {} + with zipfile.ZipFile(io.BytesIO(data)) as z: + for name in ("META-INF/spring-configuration-metadata.json", "META-INF/additional-spring-configuration-metadata.json"): + if name in z.namelist(): + for p in json.loads(z.read(name)).get("properties", []): + out.setdefault(p["name"], {}).update(p) + return out + +for a, old, new in ARTIFACTS: + o, n = props(a, old), props(a, new) + removed = sorted(set(o) - set(n)); added = sorted(set(n) - set(o)) + dep = sorted(k for k in set(n) & set(o) if ("deprecation" in n[k]) and ("deprecation" not in o[k])) + changed = sorted(k for k in set(n) & set(o) if str(n[k].get("defaultValue")) != str(o[k].get("defaultValue"))) + print(f"== {a} {old} -> {new}: {len(o)} -> {len(n)} properties") + for k in removed: print(f" removed {k}") + for k in added: print(f" added {k}" + (f" (default {n[k]['defaultValue']})" if "defaultValue" in n[k] else "")) + for k in dep: print(f" newly deprecated {k} -> {n[k]['deprecation'].get('replacement', '(no replacement)')}") + for k in changed: print(f" default changed {k}: {o[k].get('defaultValue')} -> {n[k].get('defaultValue')}") diff --git a/cloud-2026-upgrade/scripts/run-all.sh b/cloud-2026-upgrade/scripts/run-all.sh new file mode 100755 index 0000000..bb404f8 --- /dev/null +++ b/cloud-2026-upgrade/scripts/run-all.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Rebuilds everything and regenerates output/. Needs JDK 25 (21+ works for the shop), Maven 3.9+, curl, python3, +# openssl and patch. Ports 8081-8083, 8080, 8090-8095, 8761, 8888 and 9091 must be free. +# Extra Maven arguments (for example a settings file) go in MVN_ARGS. +set -uo pipefail +cd "$(dirname "$0")/.." +build() { (cd "$1" && mvn -B -q -DskipTests package ${MVN_ARGS:-}) || exit 1; } +M=${MAVEN_REPO:-https://repo1.maven.org/maven2} +W=${RUN_WRAPPER:-} # optional command put in front of every script that starts servers + +echo "== version facts" +MAVEN_REPO=$M python3 -I scripts/bom-diff.py 2025.1.5 2026.0.0 > output/01-bom-diff.txt +MAVEN_REPO=$M python3 -I scripts/props-diff.py > output/02-properties-diff.txt + +echo "== the shop, step by step" +scripts/upgrade.sh 0 0 && scripts/upgrade.sh 1 1 && scripts/upgrade.sh 2 2 && scripts/upgrade.sh 4 4 && scripts/upgrade.sh 5 5 +scripts/upgrade.sh 1 bootonly && sed -i '0,/4.1.3<\/version>/s//4.2.0<\/version>/' run/shopbootonly/pom.xml +scripts/upgrade.sh 1 cloudonly && sed -i 's/2025.1.52026.0.0'); j=s.index('',i)+len(''); open(p,'w').write(s[:i]+s[j:]) +P +build run/shopnorc +$W scripts/half-upgrades.sh +for s in 1 2 5; do $W scripts/shop-scenarios.sh "$PWD/run/shop$s"; done +scripts/collect-shop.sh +scripts/dependency-diff.sh +$W scripts/config-notify.sh "$PWD/run/shop4" 40-config-notify-record.txt +$W scripts/config-notify.sh "$PWD/run/shop5" 41-config-notify-class.txt +$W scripts/notify-without-restclient.sh "$PWD/run/shopnorc" +$W scripts/native-labels.sh "$PWD/run/shop1" "$PWD/run/shop2" + +echo "== probes" +scripts/probe-gateway.sh --build && $W scripts/probe-gateway.sh +$W scripts/shop-trusted-proxies.sh "$PWD/run/shop5" +scripts/probe-libs.sh +scripts/preview-demos.sh diff --git a/cloud-2026-upgrade/scripts/shop-scenarios.sh b/cloud-2026-upgrade/scripts/shop-scenarios.sh new file mode 100755 index 0000000..c708efa --- /dev/null +++ b/cloud-2026-upgrade/scripts/shop-scenarios.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +# Runs the shop's own scenarios (scripts/demo.sh + gotchas.sh of the parent project) on an upgraded copy. +# $1 = directory produced by upgrade.sh and already built with `mvn -DskipTests package`. +cd "$1" || exit 1 +trap 'scripts/stop.sh >/dev/null' EXIT +scripts/start.sh && scripts/demo.sh >/dev/null && scripts/gotchas.sh >/dev/null && echo SCENARIOS-DONE diff --git a/cloud-2026-upgrade/scripts/shop-trusted-proxies.sh b/cloud-2026-upgrade/scripts/shop-trusted-proxies.sh new file mode 100755 index 0000000..ef92a37 --- /dev/null +++ b/cloud-2026-upgrade/scripts/shop-trusted-proxies.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Step 3 on the real shop gateway: its configuration still comes from the config server, only the routes are +# swapped for one that points at the echo backend. $1 = built copy from upgrade.sh 3 or later. +MOD=$(cd "$(dirname "$0")/.." && pwd); cd "$1" || exit 1 +unset JAVA_TOOL_OPTIONS +mkdir -p run/logs +F=$MOD/output/25-shop-gateway-trusted-proxies.txt +java "$MOD/scripts/Echo.java" 9091 > run/logs/echo.log 2>&1 & ECHO=$! +java -Xmx200m -jar config-server/target/config-server-1.0.0.jar --eureka.client.enabled=true > run/logs/config-server.log 2>&1 & CS=$! +trap 'kill $ECHO $CS 2>/dev/null' EXIT +for _ in $(seq 1 90); do curl -fs localhost:8888/actuator/health >/dev/null 2>&1 && break; sleep 1; done +{ echo "# The shop gateway (WebMVC) on Spring Cloud 2026.0.0, client 127.0.0.1 sending: X-Forwarded-For: 198.51.100.7"; } > $F +for value in '' '10\..*' '127\.0\.0\.1'; do + TRUSTED_PROXIES="$value" java -Xmx200m -jar gateway/target/gateway-1.0.0.jar --eureka.client.enabled=false \ + '--spring.cloud.gateway.server.webmvc.routes[0].id=headers' \ + '--spring.cloud.gateway.server.webmvc.routes[0].uri=http://127.0.0.1:9091' \ + '--spring.cloud.gateway.server.webmvc.routes[0].predicates[0]=Path=/headers' > run/logs/gateway.log 2>&1 & GW=$! + for _ in $(seq 1 90); do curl -fs localhost:8080/actuator/health >/dev/null 2>&1 && break; sleep 1; done + { echo; echo "=== TRUSTED_PROXIES=${value:-}" + curl -s -H 'X-Forwarded-For: 198.51.100.7' localhost:8080/headers; } >> $F + kill $GW; wait $GW 2>/dev/null +done +cat $F diff --git a/cloud-2026-upgrade/scripts/upgrade.sh b/cloud-2026-upgrade/scripts/upgrade.sh new file mode 100755 index 0000000..1cfa8b1 --- /dev/null +++ b/cloud-2026-upgrade/scripts/upgrade.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Copies the six-service shop (../ ) into run/shop and applies the upgrade steps in order. +# Usage: scripts/upgrade.sh (0 = untouched baseline) +set -euo pipefail +MOD=$(cd "$(dirname "$0")/.." && pwd) +SHOP=$MOD/run/shop${2:-} +mkdir -p "$SHOP" +for item in pom.xml scripts config-server discovery-server gateway product-service inventory-service order-service; do + rm -rf "${SHOP:?}/$item"; cp -r "$MOD/../$item" "$SHOP/" +done +rm -rf "$SHOP"/*/target "$SHOP/run" "$SHOP/output" +n=0 +for p in "$MOD"/steps/0*.patch; do + n=$((n+1)); [ $n -le "$1" ] || break + (cd "$SHOP" && patch -p1 -s < "$p"); echo "applied $(basename "$p")" +done diff --git a/cloud-2026-upgrade/steps/01-patch-line.patch b/cloud-2026-upgrade/steps/01-patch-line.patch new file mode 100644 index 0000000..bd8fe6c --- /dev/null +++ b/cloud-2026-upgrade/steps/01-patch-line.patch @@ -0,0 +1,22 @@ +diff --git a/pom.xml b/pom.xml +index f28fef1..760dc0e 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -5,7 +5,7 @@ + + org.springframework.boot + spring-boot-starter-parent +- 4.1.1 ++ 4.1.3 + + + +@@ -17,7 +17,7 @@ + + + 21 +- 2025.1.3 ++ 2025.1.5 + + + diff --git a/cloud-2026-upgrade/steps/02-paddington.patch b/cloud-2026-upgrade/steps/02-paddington.patch new file mode 100644 index 0000000..854f557 --- /dev/null +++ b/cloud-2026-upgrade/steps/02-paddington.patch @@ -0,0 +1,22 @@ +diff --git a/pom.xml b/pom.xml +index 760dc0e..3ed16b9 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -5,7 +5,7 @@ + + org.springframework.boot + spring-boot-starter-parent +- 4.1.3 ++ 4.2.0 + + + +@@ -17,7 +17,7 @@ + + + 21 +- 2025.1.5 ++ 2026.0.0 + + + diff --git a/cloud-2026-upgrade/steps/03-trusted-proxies.patch b/cloud-2026-upgrade/steps/03-trusted-proxies.patch new file mode 100644 index 0000000..d1ca4f1 --- /dev/null +++ b/cloud-2026-upgrade/steps/03-trusted-proxies.patch @@ -0,0 +1,14 @@ +diff --git a/config-server/src/main/resources/config/gateway.yml b/config-server/src/main/resources/config/gateway.yml +index 470bee1..fb2907d 100644 +--- a/config-server/src/main/resources/config/gateway.yml ++++ b/config-server/src/main/resources/config/gateway.yml +@@ -4,6 +4,9 @@ spring: + gateway: + server: + webmvc: ++ # Regex matched against the caller's IP AND every address in X-Forwarded-For / Forwarded for=. ++ # Empty (the default here) switches the forwarding filters off: nothing is forwarded upstream. ++ trusted-proxies: ${TRUSTED_PROXIES:} + routes: + - id: products + uri: lb://product-service diff --git a/cloud-2026-upgrade/steps/04-config-notify.patch b/cloud-2026-upgrade/steps/04-config-notify.patch new file mode 100644 index 0000000..d69f91b --- /dev/null +++ b/cloud-2026-upgrade/steps/04-config-notify.patch @@ -0,0 +1,54 @@ +diff --git a/config-server/pom.xml b/config-server/pom.xml +index 5d4c296..4c66381 100644 +--- a/config-server/pom.xml ++++ b/config-server/pom.xml +@@ -18,6 +18,21 @@ + org.springframework.boot + spring-boot-starter-actuator + ++ ++ ++ org.springframework.cloud ++ spring-cloud-config-monitor ++ ++ ++ ++ org.springframework.cloud ++ spring-cloud-starter-netflix-eureka-client ++ ++ ++ ++ org.springframework.boot ++ spring-boot-starter-restclient ++ + + + +diff --git a/config-server/src/main/resources/application.yml b/config-server/src/main/resources/application.yml +index 1e4ae43..2df2b43 100644 +--- a/config-server/src/main/resources/application.yml ++++ b/config-server/src/main/resources/application.yml +@@ -10,3 +10,10 @@ spring: + search-locations: classpath:/config + server: + port: 8888 ++eureka: ++ client: ++ service-url: ++ defaultZone: ${EUREKA_URL:http://localhost:8761/eureka} ++ instance: ++ hostname: ${EUREKA_HOSTNAME:localhost} ++ instance-id: ${spring.application.name}:${server.port} +diff --git a/config-server/src/main/resources/config/application.yml b/config-server/src/main/resources/config/application.yml +index a1c6d11..56dedce 100644 +--- a/config-server/src/main/resources/config/application.yml ++++ b/config-server/src/main/resources/config/application.yml +@@ -3,7 +3,7 @@ management: + endpoints: + web: + exposure: +- include: health,info,circuitbreakers ++ include: health,info,circuitbreakers,refresh + tracing: + sampling: + probability: 1.0 diff --git a/cloud-2026-upgrade/steps/05-refreshable-properties.patch b/cloud-2026-upgrade/steps/05-refreshable-properties.patch new file mode 100644 index 0000000..4e41076 --- /dev/null +++ b/cloud-2026-upgrade/steps/05-refreshable-properties.patch @@ -0,0 +1,28 @@ +diff --git a/order-service/src/main/java/com/ankurm/shop/order/OrderProperties.java b/order-service/src/main/java/com/ankurm/shop/order/OrderProperties.java +index 773028b..38e747f 100644 +--- a/order-service/src/main/java/com/ankurm/shop/order/OrderProperties.java ++++ b/order-service/src/main/java/com/ankurm/shop/order/OrderProperties.java +@@ -2,7 +2,21 @@ package com.ankurm.shop.order; + + import org.springframework.boot.context.properties.ConfigurationProperties; + +-/** Bound from shop.order.* , which comes from the config server (order-service.yml). */ ++/** ++ * Bound from shop.order.* , which comes from the config server (order-service.yml). ++ * A class with setters, not a record: a refresh can only re-bind values into an object it can mutate. ++ */ + @ConfigurationProperties("shop.order") +-record OrderProperties(String currency, int maxQuantity) { ++class OrderProperties { ++ private String currency; ++ private int maxQuantity; ++ ++ public void setCurrency(String currency) { this.currency = currency; } ++ public void setMaxQuantity(int maxQuantity) { this.maxQuantity = maxQuantity; } ++ public String getCurrency() { return currency; } ++ public int getMaxQuantity() { return maxQuantity; } ++ ++ // the accessor names the rest of the service already uses ++ String currency() { return currency; } ++ int maxQuantity() { return maxQuantity; } + }