gateway-mvc: add transcript for the wrong Spring Retry import

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b3W3uHbHAmM3orhn7b
This commit is contained in:
asmhatre
2026-11-26 00:56:43 +05:30
co-authored by Claude Sonnet 5.5
parent 32086c1f5b
commit 3c17b13c3f
3 changed files with 22 additions and 0 deletions
+1
View File
@@ -12,6 +12,7 @@ The walkthrough lives in the blog post; everything quoted there comes from `outp
| `src/main/resources/application.yml` | the YAML flavour of a route, Tomcat limited to 10 threads, virtual threads on, `platform` profile |
| `scripts/Upstream.java` | a dependency-free backend: `/hello`, `/limited`, `/slow`, `/flaky`, `/headers` |
| `scripts/LoadClient.java` | fires N concurrent requests and prints a status summary and elapsed time |
| `scripts/wrong-retry-import.sh` | reproduces the `NoClassDefFoundError` you get from importing the Spring Retry flavour of `retry()` without Spring Retry |
| `scripts/run-all.sh` | rebuilds and regenerates every file in `output/` (needs JDK 25, Maven, `redis-server`) |
```bash
@@ -0,0 +1,5 @@
# the one-line change in a temporary copy of RoutesConfig.java
8:import static org.springframework.cloud.gateway.server.mvc.filter.GatewayRetryFilterFunctions.retry;
# startup log:
Factory method 'retryRoute' threw exception with message: org/springframework/retry/RetryPolicy
Caused by: java.lang.NoClassDefFoundError: org/springframework/retry/RetryPolicy
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Shows what happens if RoutesConfig imports GatewayRetryFilterFunctions.retry (the Spring Retry flavour)
# instead of RetryFilterFunctions.retry (the one that picks an implementation). Works on a temporary copy.
set -u
. "$(dirname "$0")/lib.sh"
TMP="$(mktemp -d)"; cp -r "$HERE/pom.xml" "$HERE/src" "$TMP/"
sed -i 's/filter\.RetryFilterFunctions\.retry/filter.GatewayRetryFilterFunctions.retry/' "$TMP/src/main/java/com/ankurm/gwmvc/RoutesConfig.java"
echo "\$ diff: the one-line change"
grep -n 'RetryFilterFunctions.retry' "$TMP/src/main/java/com/ankurm/gwmvc/RoutesConfig.java"
(cd "$TMP" && mvn -B -q -DskipTests package 2>&1 | grep -E 'ERROR|BUILD' | head -3)
stop_all
java -jar "$TMP/target/gateway-mvc-1.0.0.jar" --server.port=8099 > "$LOGDIR/wrong-import.log" 2>&1
echo "# startup log:"
grep -m1 -oE 'Factory method .retryRoute. threw exception with message: [^ ]+' "$LOGDIR/wrong-import.log"
grep -m1 'Caused by: java.lang.NoClassDefFoundError' "$LOGDIR/wrong-import.log"
rm -rf "$TMP"