Spring Cloud Professional Standards & Competencies 3 — Questions and Answers
Question 1: A team is adopting Spring Cloud and must ensure services degrade gracefully under load. Which fallback strategy is professionally recommended with Resilience4j?
- Let exceptions propagate to callers unmodified
- Define a fallback method that returns a safe default response (Correct answer)
- Restart the failing service immediately
- Increase thread pool size indefinitely
Correct answer: Define a fallback method that returns a safe default response
Defining a fallback method that returns a safe default response ensures the system remains functional for users even when a dependency fails.
Question 2: What is the professional significance of using Spring Cloud Sleuth's baggage propagation feature?
- It compresses HTTP payloads for performance
- It propagates custom key-value metadata across service boundaries within a trace (Correct answer)
- It stores logs in a centralized database automatically
- It routes requests based on baggage weight
Correct answer: It propagates custom key-value metadata across service boundaries within a trace
Baggage propagation allows custom contextual data (e.g., user ID, tenant ID) to travel with trace context across all services in a distributed call chain.
Question 3: Which Spring Cloud feature enables zero-downtime configuration updates without restarting services?
- @RefreshScope with Spring Cloud Bus (Correct answer)
- Redeploying the application JAR
- Modifying application.properties on disk
- Using Spring Boot DevTools in production
Correct answer: @RefreshScope with Spring Cloud Bus
@RefreshScope marks beans to be re-initialized on a /actuator/refresh call or Spring Cloud Bus event, enabling live configuration updates.
Question 4: A microservices architect wants to enforce API versioning at the gateway level. Which Spring Cloud Gateway feature supports this professionally?
- Circuit breaker filters
- Predicate-based routing with path prefixes like /v1/** and /v2/** (Correct answer)
- Service registry health checks
- Distributed tracing headers
Correct answer: Predicate-based routing with path prefixes like /v1/** and /v2/**
Spring Cloud Gateway's predicate-based routing can direct traffic to different service versions based on URL path prefixes, enabling clean API versioning.
Question 5: What is the professionally accepted method for securing Spring Cloud Config Server endpoints?
- Leave them open since config servers are internal
- Protect with Spring Security requiring authentication and encrypt sensitive properties (Correct answer)
- Disable all endpoints in production
- Use IP whitelisting as the sole security measure
Correct answer: Protect with Spring Security requiring authentication and encrypt sensitive properties
Config Server endpoints should require authentication via Spring Security, and sensitive values like passwords should be encrypted using Config Server's encrypt/decrypt capabilities.
Question 6: In a Spring Cloud microservices system, what does the Bulkhead pattern contribute to professional resilience design?
- It combines all service threads into a single shared pool
- It isolates resources (thread pools or semaphores) per dependency to prevent resource exhaustion (Correct answer)
- It encrypts inter-service communication
- It caches all downstream responses permanently
Correct answer: It isolates resources (thread pools or semaphores) per dependency to prevent resource exhaustion
The Bulkhead pattern partitions resource pools so that a slow or failing dependency only consumes its allocated resources, preventing it from starving other services.
Question 7: Which Spring Cloud component allows a developer to define message-driven microservices using a binder abstraction over Kafka or RabbitMQ?
- Spring Cloud Consul
- Spring Cloud Stream (Correct answer)
- Spring Cloud Gateway
- Spring Cloud Sleuth
Correct answer: Spring Cloud Stream
Spring Cloud Stream provides a binder abstraction that decouples business logic from the messaging middleware, supporting both Kafka and RabbitMQ.
A team is adopting Spring Cloud and must ensure services degrade gracefully under load.
Which fallback strategy is professionally recommended with Resilience4j?