How can you customize Ribbon’s load-balancing strategy in a Spring Cloud application?
- By configuring the ribbon.strategy property in application.properties.
- By implementing a custom IRule and configuring it as a bean.
- By using the @LoadBalanced annotation on RestTemplate.
- By setting the ribbon.loadBalancer property in the service configuration.
In a Spring Cloud application, you can customize Ribbon's load-balancing strategy by implementing a custom IRule and configuring it as a bean. Ribbon uses IRule to determine which instance to route a request to. By creating a custom IRule, you can define your own load-balancing logic. The other options are not used to customize Ribbon's load-balancing strategy. The @LoadBalanced annotation is used to enable client-side load balancing with RestTemplate. The ribbon.strategy and ribbon.loadBalancer properties are not used for customizing the load-balancing strategy directly.
Loading...
Related Quiz
- What does the @ConditionalOnClass annotation do in the context of Auto Configuration?
- How can you ensure that a Spring Boot application does not interact with external systems during integration testing?
- Which annotation is primarily used in Spring Boot to mark the main class of your application?
- The _____ annotation in Spring is used to give a preference to a bean when multiple beans of the same type exist.
- In a typical Spring Boot application, which of the following is used to assert that the actual result meets the expected result?