Real-world Spring Boot patterns with working code & Docker setup.
Most tutorials show you how to build a Spring Boot app. This repo shows you what to do when it breaks in production.
Every pattern includes:
- ✅ Working Spring Boot code
- ✅ Docker Compose setup
- ✅ When to use & when NOT to use
| # | Pattern | Description | Status |
|---|---|---|---|
| 01 | Circuit Breaker | Stop cascading failures when a service goes down | ✅ Done |
| 02 | Rate Limiting | Control how many requests a client can make | ✅ Done |
| 03 | Retry Logic | Automatically retry failed operations with backoff | ✅ Done |
| 04 | Idempotency | Prevent duplicate processing of the same request | ✅ Done |
| 05 | Caching | Reduce DB load by serving repeated requests from cache | ✅ Done |
| 06 | Bulkhead | Isolate failures using separate thread pools per service | ✅ Done |
| 07 | Health Check | Monitor service health via actuator endpoints | ✅ Done |
| 08 | Throttling | Control concurrent requests per user with Semaphore | ✅ Done |
| 09 | Graceful Shutdown | Complete in-flight requests before shutting down | ✅ Done |
| 10 | Dead Letter Queue | Preserve failed messages for retry and investigation | ✅ Done |
Each pattern is standalone. Just go to any folder and run:
cd <pattern-folder>/<project-folder>
./mvnw spring-boot:runOr with Docker:
cd <pattern-folder>
docker-compose upContributions are welcome! Please read CONTRIBUTING.md first.
Prashant Maurya
- GitHub: @prashantpiyush1111
- LinkedIn: prashantpiyush1111
MIT License — free to use, modify, and distribute.