Spring_Cloud_Interview_Problems
Spring_Cloud_Interview_Problems
How does Spring Cloud Config Server work and what problems does it solve?
Spring Cloud Config Server externalizes application configuration.
Central source of truth for configuration across environments (dev/staging/prod).
Backed by Git, Vault, JDBC, etc.
Clients fetch config via HTTP or auto-refresh using Spring Cloud Bus (with
RabbitMQ/Kafka).
Solves problems of duplication, inconsistency, and manual deployment of configuration.
What is the role of Eureka in Spring Cloud and how does it enable service
discovery?
Eureka is a service registry — it allows services to register and discover each other.
Each service registers with Eureka and periodically sends heartbeats.
Clients use Eureka Client or DiscoveryClient to discover other services.
Enables dynamic scaling — services can come and go without hardcoded URLs.
Commonly paired with Ribbon for client-side load balancing.
How does Spring Cloud Gateway differ from Zuul and what are its advantages?
Spring Cloud Gateway is the modern, reactive alternative to Zuul (based on Spring
WebFlux).
Advantages:
Built on Project Reactor — non-blocking and high-performance.
Supports route filters, predicates, rate limiting, path rewriting, and CORS out of the box.
First-class support for Spring Security and Resilience4J.
Better integration with reactive microservices compared to Zuul 1 (which is servlet-
based).
What are common fault tolerance mechanisms in Spring Cloud and how do you
implement them?
Spring Cloud supports fault tolerance via:
Circuit Breakers (Resilience4J), retries, timeouts, bulkheads.
Implementation using Resilience4J:
@Retry, @CircuitBreaker, @RateLimiter, @Bulkhead annotations.
Fallback methods to handle failure scenarios.
Configuration via application.yml — set thresholds, wait durations, exception filters.
Circuit breakers prevent cascading failures by short-circuiting repeated failures.