Video in progress

Junior 🌱 Spring

What is Spring Cloud, and what problems was it created to solve?

Spring Cloud is a set of projects on top of Boot. It covers the typical problems of a distributed system: central configuration, service discovery, a gateway, load balancing, circuit breakers.

📖 Answer

In a monolith there was one application. Once you move to microservices, new questions appear:

Problem Spring Cloud component
Where do we store the settings of 20 services? Spring Cloud Config
What's the address of service B, and how many instances does it have? Eureka, Consul (service discovery)
How do we spread requests across instances? Spring Cloud LoadBalancer
The entry point from the outside world Spring Cloud Gateway
If one service goes down, the others shouldn't go down with it Spring Cloud Circuit Breaker (Resilience4j)
Calling another service conveniently OpenFeign

Versions work differently: Spring Cloud ships as a "release train" (for example 2024.0.x), and each train is compatible only with certain Boot versions. You usually import the spring-cloud-dependencies BOM and add the components without versions. A mismatched pair fails at startup.

In Kubernetes the platform itself provides part of discovery, configuration and load balancing, so you don't always need all of Spring Cloud there.