Files

1.8 KiB

gateway-mvc

Spring Cloud Gateway Server MVC 5.1.0 on Spring Boot 4.2.0 / Spring Cloud 2026.0.0, JDK 25, virtual threads. Standalone: it has its own parent POM and is not part of the root build (the rest of the repo is on Boot 4.1 / Cloud 2025.1).

The walkthrough lives in the blog post; everything quoted there comes from output/.

Path What it is
src/main/java/com/ankurm/gwmvc/RoutesConfig.java routes in the Java DSL: strip prefix, header filters, retry, rate limit, 504 mapping, a diagnostics endpoint
src/main/java/com/ankurm/gwmvc/RateLimiterConfig.java the AsyncProxyManager<String> the rateLimit() filter needs: Redis (Lettuce), Caffeine or none
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)
mvn -DskipTests package
java scripts/Upstream.java 9091 &
java -jar target/gateway-mvc-1.0.0.jar --demo.store=redis      # Redis on localhost:6379
curl -i localhost:8080/api/hello

Switches: --demo.store=redis|caffeine|none, --spring.profiles.active=platform (no virtual threads), --demo.rl-timeout=300ms, --spring.http.clients.read-timeout=1s, --spring.cloud.gateway.server.webmvc.trusted-proxies='.*'.

Timing figures (elapsed_ms, time_total) drift between runs; everything else in output/ is deterministic.