I am using Spring FeignClient and have to support a load balancing like Spring Ribbon provides.
@FeignClient(name = "testClient", url = "${test.url}", configuration = TestConfig.class)
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes =
MediaType.APPLICATION_JSON_VALUE)
public interface TestClient {
}
public class TestConfig{
@Bean
public Client feignClient() {
return new ApacheHttpClient(getHttpClient());
}
}
I want to understand how can I add Ribbon to the configuration.
You can set the configurations properties like so:
hello-service:
ribbon:
eureka:
enabled: false
listOfServers: localhost:8090,localhost:9092,localhost:9999
without eureka:
stores:
ribbon:
listOfServers: example.com,google.com