Why this matters
- Hardcoding
http://inventory-service:8081in every client breaks when services move, scale, or get replaced during a deploy. - A central config server lets you change payment gateway URLs or feature flags across all services without rebuilding images.
- An API gateway gives BookStore customers one entry point while routing to catalog, order, and payment services behind the scenes.
Service discovery
L1 · FresherClients resolve catalog-service instances via Eureka or Kubernetes DNS instead of hard-coded hosts.
Config server
L2 · IntermediateCentralized configuration with refresh scopes — secrets still belong in vaults, not git repos.
API gateway
L3 · AdvancedSpring Cloud Gateway routes, rate-limits, and authenticates at the edge before BookStore microservices.
Distributed monolith smell
L4 · ExpertIf every change requires coordinated releases, fix modulith boundaries before adding more network hops.
Config server + service registry sit beside the mesh
Spring Cloud components for BookStore
- Spring Cloud Gateway — reactive edge proxy; routes, rate-limits, and authenticates incoming traffic.
- Eureka / Consul — service registry; instances register on startup and deregister on shutdown.
- Spring Cloud Config — centralised
application.ymlserved per service and profile. @LoadBalanced RestClient— resolves service names through the registry instead of hardcoded hosts.- Spring Cloud Kubernetes — alternative to Eureka when you deploy on K8s and use native service discovery.
Service registry with Eureka
{/* Eureka server (separate deployable) */}
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 3 sections
- API Gateway routing
- Centralised configuration
- Load-balanced client calls
Test yourself
Answer these before moving on — recall is what makes it stick.