i use different load balance IRule but aways default RoundRobinRule my code https://github.com/xj198806/feign-test.git
Help me see what the problem thks
Comment From: ryanjbaxter
IRule is a Ribbon routing configuration for a Feign Client configuration.
http://cloud.spring.io/spring-cloud-static/Camden.SR6/#_customizing_the_ribbon_client
You can also customize the load balancer rule using properties. http://cloud.spring.io/spring-cloud-static/Camden.SR6/#_customizing_the_ribbon_client_using_properties
Comment From: xj198806
actually i want to know why configuration do not take effect in the @FeignClient
i put the configuration in a separate, non-overlapping package, or specify the packages to scan explicitly in the @ComponentScan but it do not take effect.
https://github.com/xj198806/feign-test
the Contract do not take effect. i am confused
Comment From: ryanjbaxter
Try adding @ComponentScan( basePackageClasses = {RemoteAddConfiguration.class}) to your application class.
Comment From: xj198806
you mean like this?
if i do so, It does not work. if i add @ComponentScan( basePackageClasses = {RemoteAddConfiguration.class}) ,i only get one component with type RemoteAddConfiguration. and my @RestController does not work too.
Comment From: ryanjbaxter
When I did this I at least saw RemoteAddConfiguration.feignContract being called. What do you mean you only get one component with type RemoteAddConfiguration? Can you perhaps simplify the sample application you provided so it does not require Consul etc? That would make it much easier for me to run and investigate the problem.
Comment From: xj198806
i find it work if it does not require Consul etc, so i guess it is something wrong for @FeignClient with consul.
i use url to call the service, then the 'configuration = RemoteAddConfiguration.class' tack effect.
but if i use consul for service discovery the configuration does not tack effect.
it is my simple consul service:https://github.com/xj198806/spring-cloud-consul-service.git
Comment From: spencergibb
You're using an old version of spring cloud, can you try with Dalston.RELEASE or Camden.SR6?
Comment From: xj198806
i tried this two version but seems like the same with Brixton.SR5.
Comment From: ryanjbaxter
I think I narrowed down the problem now. It has to do that both RemoteMultiplyService and RemoteAddService are using the same value for name in their Feign Client annotations. When we register the Feign Clients we register the bean definition with the same name for both clients.
https://github.com/spring-cloud/spring-cloud-netflix/blob/master/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/FeignClientsRegistrar.java#L376
Combining the two clients can solve the problem. If you need them to be separate you can try defining the clients manually.
Comment From: xj198806
ok i think i know. tks~ : )
Comment From: tonyfarney
I was with the same problem: configuration not taking effect. Thanks to @ryanjbaxter I figured out there was other clients using the same name. That was causing the problem.