Describe the bug If client application communicates with multiple services through restTemplate, how to declare separate RibbonClient for each service? For context, I have two services provider as user and house .Each service has different Irule and already excludes from component Scan. But I get exception like this :No qualifying bean of type 'com.netflix.loadbalancer.IRule' available: expected single matching bean but found 2: ribbonHouseRule,ribbonRule

Sample ------------------------------------------ApiGatewayApplication--------------------------------

@SpringBootApplication
@EnableDiscoveryClient
@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ANNOTATION, value = { ExcludeComponent.class }))
@RibbonClients(value = { @RibbonClient(name = "user", configuration = NewRuleConfig.class),
        @RibbonClient(name = "house", configuration = NewRuleConfigHouse.class) })
public class ApiGatewayApplication {
    public static void main(String[] args) {
        SpringApplication.run(ApiGatewayApplication.class, args);
    }
}

------------------------------------------ExcludeComponent--------------------------------

public @interface ExcludeComponent {

}

------------------------------------------NewRuleConfig --------------------------------

@Configuration
@ExcludeComponent
public class NewRuleConfig {
    @Bean
    public IRule ribbonRule() {
        return new RoundRobinRule();
    }
}

------------------------------------------NewRuleConfigHouse--------------------------------

@Configuration
@ExcludeComponent
public class NewRuleConfigHouse{
    @Bean
    public IRule ribbonHouseRule() {
        return new RandomRule();
    }
}

Comment From: OlgaMaciaszek

Hello, @ljboy1979. Please learn how to properly format code and logs. Could you please try removing both @Configuration and @ExcludeComponent from NewRuleConfigHouse and NewRuleConfig and let me know if that helps?

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.