Difference between RibbonClient and LoadBalanced
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
@RibbonClient and @LoadBalanced are related, but they solve different problems. Historically in Spring Cloud Netflix, @RibbonClient customized a named Ribbon load-balancer client, while @LoadBalanced marked an HTTP client bean so service names such as http://orders could be resolved through a client-side load balancer.
What @LoadBalanced Does
@LoadBalanced is attached to a bean such as RestTemplate or WebClient.Builder. It tells Spring to intercept requests to logical service names and send them through the configured load-balancer client.
With that bean in place, code like restTemplate.getForObject("http://inventory/items", String.class) can use service discovery and client-side load balancing instead of a fixed host name.
What @RibbonClient Does
@RibbonClient is not about marking a RestTemplate. It is about customizing the load-balancer behavior for a particular named service client.
That custom configuration might change the rule used to choose instances, timeouts, retry settings, or the list of servers when service discovery is not being used.
So the relationship is:
- '
@LoadBalancedmakes the HTTP client participate in load balancing' - '
@RibbonClientcustomizes how a specific Ribbon-backed client behaves'
They are not strict alternatives. In older Ribbon-based applications, you often used both.
How They Worked Together
In a classic Spring Cloud Netflix setup, a @LoadBalanced RestTemplate would delegate instance selection to Ribbon. If you also declared @RibbonClient(name = "inventory", ...), requests to the inventory service used that custom Ribbon configuration.
That means one annotation was on the caller bean, and the other was on configuration for a named downstream service.
The Modern Context
Ribbon is now in maintenance mode, and newer Spring Cloud applications generally use Spring Cloud LoadBalancer instead. The idea behind @LoadBalanced still exists, but the customization annotation in newer setups is typically @LoadBalancerClient, not @RibbonClient.
A modern replacement looks more like this:
The conceptual split is the same: one piece marks the client bean, and another piece customizes the named service behavior.
Which One Should You Use
If you are maintaining an older Ribbon-based application, use @LoadBalanced when you need service-name resolution on an HTTP client, and use @RibbonClient only when you need named Ribbon customization.
If you are building a new application, prefer Spring Cloud LoadBalancer. In that world, @LoadBalanced remains relevant, but Ribbon-specific customization should not be added to new code unless you are stuck on legacy dependencies.
Common Pitfalls
- Treating
@RibbonClientand@LoadBalancedas if they were interchangeable. - Adding
@RibbonClientwhen all you needed was a load-balancedRestTemplate. - Forgetting that
@RibbonClientis service-specific, not a global marker for every HTTP client. - Adding Ribbon to a new project instead of using Spring Cloud LoadBalancer.
- Assuming
@LoadBalancedworks without a load-balancer implementation on the classpath.
Summary
- '
@LoadBalancedmarks an HTTP client bean so service names can be resolved through client-side load balancing.' - '
@RibbonClientcustomizes a specific named Ribbon client.' - In older Ribbon stacks, the two annotations were often used together.
- Ribbon is legacy now; new projects should prefer Spring Cloud LoadBalancer.
- The key distinction is client participation versus named-client customization.

