Spring Cloud Test 1

    Question 1SERVICE DISCOVERY - Eureka Server Annotation

    Which annotation enables a Spring Boot application to act as a Eureka Server?

    Question 2API GATEWAY - Purpose of Spring Cloud Gateway

    What is the primary role of Spring Cloud Gateway in a microservices architecture?

    Question 3CENTRALIZED CONFIG - Purpose of Spring Cloud Config

    What is the main role of Spring Cloud Config Server in a microservices setup?

    Question 4CIRCUIT BREAKEER - Purpose of Circuit Breaker

    What is the main goal of using a Circuit Breaker in a microservice?

    Question 5DISTRIBUTED TRACING - Purpose of Distributed Tracing

    What is the primary purpose of distributed tracing in microservices?

    Question 6SERVICE DISCOVERY - Eureka Client Annotation

    Which annotation registers a Spring Boot application as a Eureka Client?

    Question 7API GATEWAY - Code Snippet (Basic Route)

    What does this configuration achieve?

    @Bean public RouteLocator routes(RouteLocatorBuilder builder) { return builder.routes() .route("order_route", r -> r.path("/orders/**") .uri("http://localhost:8081")) .build(); }

    Question 8CENTRALIZED CONFIG - Code Snippet (Enable Config Server)

    What does the following class represent?

    @SpringBootApplication @EnableConfigServer public class ConfigServerApplication { public static void main(String[] args) { SpringApplication.run(ConfigServerApplication.class, args); } }

    Question 9CIRCUIT BREAKEER - States of Circuit Breaker

    Which is not a valid state of Resilience4j Circuit Breaker?

    Question 10DISTRIBUTED TRACING - Spring Cloud Sleuth Role

    What does Spring Cloud Sleuth do in a Spring Boot microservice?

    Question 11SERVICE DISCOVERY - Code Snippet (Eureka Server Setup)

    What role does this application play?

    @SpringBootApplication @EnableEurekaServer public class DiscoveryServerApplication { public static void main(String[] args) { SpringApplication.run(DiscoveryServerApplication.class, args); } }

    Question 12API GATEWAY - Using Service Discovery

    How do we enable service discovery–based routing in Spring Cloud Gateway with Eureka?

    Question 13CENTRALIZED CONFIG - Config Server Backend

    By default, where does Spring Cloud Config Server fetch configurations from?

    Question 14CIRCUIT BREAKEER - Code Snippet (Annotation Usage)

    What does this method do?

    @CircuitBreaker(name = "orderService", fallbackMethod = "orderFallback") public String placeOrder() { return restTemplate.getForObject("http://payment-service/pay", String.class); }

    Question 15DISTRIBUTED TRACING - Code Snippet (Enable Sleuth and Zipkin)

    What is achieved by this configuration in application.yml?

    spring: zipkin: base-url: http://localhost:9411 enabled: true sleuth: sampler: probability: 1.0

    Question 16SERVICE DISCOVERY - Code Snippet (Eureka Client Setup)

    What is configured by the following snippet?

    @SpringBootApplication @EnableEurekaClient public class PaymentServiceApplication { public static void main(String[] args) { SpringApplication.run(PaymentServiceApplication.class, args); } }

    Question 17API GATEWAY - Code Snippet (Discovery Routing)

    What does this route config do?

    spring: cloud: gateway: routes: - id: payment_route uri: lb://payment-service predicates: - Path=/payments/**

    Question 18CENTRALIZED CONFIG - Code Snippet (Config Server Properties)

    What does this application.yml config achieve?

    spring: cloud: config: server: git: uri: https://github.com/myorg/config-repo

    Question 19RESILIENCE - Fallback Method Rule

    In Resilience4j, what must be true for a fallback method?

    Question 20DISTRIBUTED TRACING - Span vs Trace

    Which statement is correct?