Careeroza
Why Centralized Configuration
The Problem
ShopEase has 4 services, each with dev, test and prod settings, and each running several instances. If the Razorpay timeout or the "max items per order" value lives inside each jar, a change means rebuild, redeploy and restart. Settings also drift: one copy of order-service ends up with an old value.
Spring Cloud Config Server serves configuration over HTTP from one place (usually a Git repo). Services fetch their settings at startup.
config-repo (Git) Config Server :8888
├── application.yml (all services) |
├── order-service.yml | GET /order-service/prod
├── order-service-prod.yml ---- clone ----> |
├── product-service.yml v
└── payment-service-prod.yml order-service (profile prod)
product-service, payment-service ...Benefits
| Benefit | What it means |
|---|---|
| One source of truth | All settings in one repo, reviewed through pull requests |
| History and rollback | Git log shows who changed what; git revert undoes a bad change |
| Per environment | order-service-dev.yml, order-service-prod.yml |
| Change without rebuild | Edit the repo and refresh; no new jar |
| Shared defaults | application.yml in the repo applies to every service |
Note: On Kubernetes, many teams use ConfigMaps and Secrets instead (advance level). The idea is the same: config lives outside the jar (the 12-factor rule from the basic level).