Spring Cloud Research & Evidence-Based Practice 5 — Questions and Answers
Question 1: When adopting Spring Cloud Kubernetes ConfigMap-based configuration, evidence-based practice recommends enabling which feature to refresh beans without a pod restart?
- Setting spring.cloud.kubernetes.config.enabled=false and using environment variables instead
- Enabling spring.cloud.kubernetes.config.reload.enabled=true to hot-reload properties on ConfigMap change (Correct answer)
- Mounting ConfigMaps as volumes only, never using the Config client
- Triggering a Kubernetes rolling update for every configuration change
Correct answer: Enabling spring.cloud.kubernetes.config.reload.enabled=true to hot-reload properties on ConfigMap change
The reload feature watches the Kubernetes API for ConfigMap changes and triggers a context refresh, enabling dynamic configuration without a pod restart.
Question 2: A research survey of Spring Cloud teams found that which observability gap most frequently delays mean time to resolution (MTTR) during incidents?
- Lack of Git commit hashes in application logs
- Missing correlation between distributed traces and application logs, making it impossible to isolate log lines for a failing request (Correct answer)
- Absence of automated heap dump collection
- Not logging full HTTP response bodies
Correct answer: Missing correlation between distributed traces and application logs, making it impossible to isolate log lines for a failing request
Without trace ID injection into logs, engineers cannot filter logs to a single request trace, forcing time-consuming manual log triage during incidents.
Question 3: Evidence from production Spring Cloud deployments shows that when using Resilience4j Semaphore BulkHead, which misconfiguration most commonly causes thread starvation?
- Setting maxConcurrentCalls too high, exhausting the thread pool of the calling service
- Setting maxConcurrentCalls lower than the number of container request threads that can simultaneously invoke the bulkheaded method (Correct answer)
- Using BulkHead without a corresponding TimeLimiter
- Setting maxWaitDuration to zero
Correct answer: Setting maxConcurrentCalls lower than the number of container request threads that can simultaneously invoke the bulkheaded method
If the bulkhead limit is smaller than the container thread pool, incoming request threads block waiting for a permit, eventually exhausting all container threads and causing starvation.
Question 4: A/B testing evidence for Spring Cloud Contract (consumer-driven contracts) versus integration tests demonstrates which primary benefit?
- Contract tests run faster than unit tests because they avoid starting a Spring context
- They detect API breaking changes in CI without deploying both services simultaneously, dramatically shortening the feedback loop (Correct answer)
- Contract tests fully replace end-to-end tests
- They eliminate the need for API documentation
Correct answer: They detect API breaking changes in CI without deploying both services simultaneously, dramatically shortening the feedback loop
Consumer-driven contracts catch API incompatibilities at the provider's build stage without a full integrated environment, reducing feedback time compared to full integration test suites.
Question 5: Research into Spring Cloud Gateway route predicate ordering demonstrates that routes must be defined in which order to function correctly?
- Wildcard path predicates first, then specific paths, for efficiency
- More-specific routes before less-specific (wildcard) routes to prevent broad predicates from shadowing narrower ones (Correct answer)
- Route order has no effect; Spring Cloud Gateway evaluates all routes and picks the best match
- Routes should be defined alphabetically by route ID
Correct answer: More-specific routes before less-specific (wildcard) routes to prevent broad predicates from shadowing narrower ones
Spring Cloud Gateway evaluates routes in definition order and uses the first match; placing wildcard routes first causes them to shadow all subsequently defined specific routes.
Question 6: Case-study evidence on Spring Cloud Stream partitioning shows that choosing an effective partition key expression is critical for which outcome?
- Ensuring messages from the same logical entity (e.g., the same customer ID) are always processed by the same consumer instance, preserving ordering (Correct answer)
- Increasing the total throughput of the message broker
- Reducing the number of Kafka partitions required
- Preventing duplicate message delivery
Correct answer: Ensuring messages from the same logical entity (e.g., the same customer ID) are always processed by the same consumer instance, preserving ordering
A partition key grouping related messages (e.g., by entity ID) guarantees they land on the same partition and are consumed by the same instance, which is necessary for ordering guarantees.
Question 7: Evidence-based guidance on Spring Cloud Config encryption recommends using asymmetric (RSA) keys over symmetric keys in which scenario?
- When only one service consumes the encrypted properties
- When the Config Server should encrypt but clients should decrypt with their own private keys, so the server never holds the decryption secret (Correct answer)
- When properties contain fewer than 256 characters
- When the config backend is a local file system
Correct answer: When the Config Server should encrypt but clients should decrypt with their own private keys, so the server never holds the decryption secret
Asymmetric encryption allows the Config Server to encrypt with a public key while each client decrypts with its own private key, so the server never possesses the decryption secret.
When adopting Spring Cloud Kubernetes ConfigMap-based configuration, evidence-based practice recommends enabling which feature to refresh beans without a pod restart?