Although Feign client proxy are created during bootstrap, the actual handling chain behind them is created lazily the first time the Feign proxy/client is actually used, i.e. at runtime. This lazy init is performed by CachingLBClientFactory --> SpringLBClientFactorty --> SpringClientFactory.

The runtime init may fail because of bad configuration parameters, so I'd like to trigger it early during startup to avoid issues at runtime. The only solution I found so far is to: - find beans in the context with the @FeignClient annotation - get the corresponding serviceId (duplicating the logic found in FeignClientRegistrar - call `CachingLBClientFactory.create()

Is there any easiest/cleaner way to do it?

Comment From: spencergibb

Is this an enhancement request or are you seeing a problem? We moved to lazy creation because of other problems that are caused when in certain situations (with spring-data).

Comment From: spencergibb

I see you want the client early to check for configuration errors early.

Comment From: spencergibb

We could make it an opt-in setting (something like feign.ribbon.warmup=true). Your impl sounds right, but we could share the service id function.

Comment From: brenuart

opt-in seems a good idea to me. How would you do it? By making the FeignClientFactory a Lifecycle bean whose start() method would conditionally call getObject() to trigger the init?

Comment From: brenuart

@spencergibb if our approach sounds good to you, then I can issue a PR to share what we have done. Do I have your go?

Comment From: spencergibb

@brenuart certainly

Comment From: mkostin

@spencergibb has it been addressed? Looks like I am hitting the same issue and would love to take a look at either of the approaches mentioned above.

@brenuart could you please share the PR you're referring to or maybe a gist of the initial workaround?

Comment From: spencergibb

No, he has not submitted a PR.

Comment From: christophe-f

Same here. You can create 2 services A & B. If service A make a request to service B using openfeign or spring cloud feign the first request always timeout and fails. After that everything is good.

Apply to both Brixton and Camden version.

Comment From: DustinWang

feign.ribbon.warmup=true

Comment From: christophe-f

FYI, I don't have the issue after upgrading to Dalston.

DynamicServerListLoadBalancer is initialized much faster and don't timeout at the first request. Could it be initialized right after registering to Eureka?

Comment From: baloo2401

Well I have the same issue and I am using Dalson

Comment From: Alberthoven

I am using Dalston.SR1 and I have the same problem too. Any solution?

Comment From: spencergibb

@Alberthoven https://github.com/spring-cloud/spring-cloud-netflix/issues/384#issuecomment-253577717

Comment From: hqxy

Will Springcloud.Finchley.RELEASE still have this problem?

Comment From: OlgaMaciaszek

Spring Cloud Finchley is no longer supported and we strongly support upgrading it to Hoxton (Greenwich is no longer supported either). @hqxy Please verify if the issue still occurs in Hoxton.SR3 (you can also switch to a different LoadBalancer implementation then and, thus, different way of creating Feign LB clients by setting spring.cloud.loadbalancer.ribbon.enabled to false ). Let me know if that helps.

Comment From: ffyyhh995511

i am facing same issue. my project info is Hoxton.SR9、Supported Boot Version: 2.3.5.RELEASE

Comment From: ffyyhh995511

feign.ribbon.warmup=true

it does not work by spring cloud Hoxton.SR9 and springboot 2.3.5.RELEASE

Comment From: OlgaMaciaszek

Closing as issue related to Ribbon, which is no longer supported.