Spring Cloud Technology & Digital Applications 4 — Questions and Answers
Question 1: Which actuator endpoint must be exposed to trigger a live configuration refresh on a Spring Cloud Config client without restarting?
- /actuator/health
- /actuator/refresh (Correct answer)
- /actuator/env
- /actuator/configprops
Correct answer: /actuator/refresh
POST-ing to /actuator/refresh causes the application context to re-fetch properties from Config Server and re-bind @RefreshScope beans.
Question 2: What Spring Cloud abstraction wraps Resilience4j or Sentinel so applications aren't tied to a specific circuit breaker library?
- Spring Cloud Sleuth
- Spring Cloud Circuit Breaker API (Correct answer)
- Spring Cloud Function
- Spring Cloud Task
Correct answer: Spring Cloud Circuit Breaker API
Spring Cloud Circuit Breaker provides a unified facade over multiple circuit breaker implementations, enabling library-agnostic code.
Question 3: In Spring Cloud Stream, what is a 'binding'?
- A TLS certificate linking the service to a broker
- The bridge between a messaging channel and a message broker destination (Correct answer)
- A Kubernetes service account token
- A load balancer rule for queues
Correct answer: The bridge between a messaging channel and a message broker destination
A binding in Spring Cloud Stream connects a named channel (input/output) in the application to a physical topic or queue on the broker.
Question 4: Which property controls the maximum number of retry attempts in a Spring Cloud Gateway retry filter?
- spring.cloud.gateway.retry.max-attempts
- spring.cloud.gateway.filter.retry.retries
- retries (in the Retry filter config) (Correct answer)
- spring.cloud.loadbalancer.retry.max-retries-on-next-service-instance
Correct answer: retries (in the Retry filter config)
The Retry GatewayFilter is configured with a 'retries' field directly in the route's filter definition, not a top-level property.
Question 5: What is the purpose of the @RefreshScope annotation in a Spring Cloud application?
- Marks a bean to be destroyed and recreated after a config refresh event (Correct answer)
- Enables distributed tracing for the annotated bean
- Registers the bean with the service registry
- Forces eager initialization of the bean at startup
Correct answer: Marks a bean to be destroyed and recreated after a config refresh event
@RefreshScope causes the annotated bean to be lazily re-initialized with new property values when a /actuator/refresh event is triggered.
Question 6: Which Spring Cloud project provides first-class support for running short-lived, batch-style microservices on cloud platforms?
- Spring Cloud Function
- Spring Cloud Task (Correct answer)
- Spring Cloud Stream
- Spring Cloud Data Flow
Correct answer: Spring Cloud Task
Spring Cloud Task is designed for finite, short-lived Spring Boot applications that record execution status and exit, suitable for batch jobs.
Question 7: When a Eureka client registers, which property sets the hostname or IP used by other services to reach it?
- eureka.instance.appname
- eureka.instance.hostname (Correct answer)
- eureka.client.service-url.defaultZone
- eureka.instance.lease-renewal-interval-in-seconds
Correct answer: eureka.instance.hostname
eureka.instance.hostname sets the address published in the registry so other clients can construct the URL to call this service.
Which actuator endpoint must be exposed to trigger a live configuration refresh on a Spring Cloud Config client without restarting?