Files
spring-boot-microservices-p…/gateway-mvc/README.md
T

29 lines
1.7 KiB
Markdown

# 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/run-all.sh` | rebuilds and regenerates every file in `output/` (needs JDK 25, Maven, `redis-server`) |
```bash
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.