Spring Cloud Case Studies & Practical Application 2 — Questions and Answers
Question 1: A retail company notices that their order service frequently fails when the inventory service is slow. Which Spring Cloud pattern should they implement first to prevent cascading failures?
- Spring Cloud Gateway rate limiting
- Resilience4j Circuit Breaker on the order service (Correct answer)
- Spring Cloud Config externalized timeouts
- Eureka health check intervals
Correct answer: Resilience4j Circuit Breaker on the order service
A Circuit Breaker on the calling service (order) opens after repeated failures, preventing cascading overload to the already-slow inventory service.
Question 2: An e-commerce platform uses Spring Cloud Config Server backed by Git. A developer pushes a bad property that crashes all payment microservices. What is the fastest recovery approach?
- Restart the Config Server
- Revert the Git commit and call /actuator/refresh on each service (Correct answer)
- Delete the Config Server cache
- Redeploy all payment service instances
Correct answer: Revert the Git commit and call /actuator/refresh on each service
Reverting the Git commit fixes the source and calling /actuator/refresh (or /actuator/bus-refresh with Spring Cloud Bus) propagates the corrected config without redeployment.
Question 3: A startup runs 5 microservices locally for development. Developers are frustrated by manually updating hostnames in each service's application.yml. What Spring Cloud solution eliminates this?
- Spring Cloud Sleuth distributed tracing
- Spring Cloud Netflix Eureka service discovery (Correct answer)
- Spring Cloud Gateway static routing
- Spring Cloud Contract consumer-driven tests
Correct answer: Spring Cloud Netflix Eureka service discovery
Eureka allows services to register themselves and discover peers by logical name, eliminating hard-coded hostnames in configuration.
Question 4: A financial firm needs all inter-service HTTP calls logged with a shared trace ID for audit purposes. Which Spring Cloud component provides this out of the box?
- Spring Cloud Config
- Spring Cloud Bus
- Spring Cloud Sleuth (Micrometer Tracing) (Correct answer)
- Spring Cloud OpenFeign
Correct answer: Spring Cloud Sleuth (Micrometer Tracing)
Spring Cloud Sleuth (now Micrometer Tracing) automatically instruments HTTP calls with trace and span IDs that propagate across service boundaries.
Question 5: A team uses OpenFeign to call a product service. During load testing, they see thread pool exhaustion. Which Resilience4j integration change best addresses this?
- Switch from BulkheadType.THREADPOOL to BulkheadType.SEMAPHORE (Correct answer)
- Increase the Feign connection pool size only
- Disable Feign retries
- Add a Eureka health check endpoint
Correct answer: Switch from BulkheadType.THREADPOOL to BulkheadType.SEMAPHORE
Semaphore bulkheads limit concurrent calls without spawning extra threads, preventing thread pool exhaustion while still controlling concurrency.
Question 6: A logistics company wants canary deployments where 10% of traffic goes to the new version of their shipment service. Which Spring Cloud Gateway feature enables this without changing client code?
- RewritePath filter
- Weighted Route predicates (Correct answer)
- CircuitBreaker GatewayFilter
- RequestRateLimiter filter
Correct answer: Weighted Route predicates
Spring Cloud Gateway's weighted route predicates distribute traffic across multiple route definitions by configurable weight percentages.
Question 7: A media company's microservices share secrets stored in Spring Cloud Config. Security audit requires that secrets never appear in Git. What is the recommended approach?
- Base64-encode secrets in the Git repo
- Use Spring Cloud Config Server with HashiCorp Vault backend for secrets (Correct answer)
- Store secrets in application.properties inside Docker images
- Encrypt secrets with a symmetric key in application.yml
Correct answer: Use Spring Cloud Config Server with HashiCorp Vault backend for secrets
Vault backend keeps secrets out of Git entirely; Config Server fetches them from Vault at runtime, satisfying the audit requirement.
A retail company notices that their order service frequently fails when the inventory service is slow.
Which Spring Cloud pattern should they implement first to prevent cascading failures?