You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to declare a feign.Client bean (the http one) for each feign client. Furthermore, I want these feign.Client to be customized for each feign client.
If I have a configuration that produces feign.Client in the context used by FeignClientFactoryBean then I will be able to control the feign.Client retrieved by FeignClientFactoryBean. EnableFeignClients#defaultConfiguration allows to do this so I declared this:
The problem with this code is that clientName is always equal to the name of the first Feign client instantiated. This is because there is no FeignClientFactoryBean in the current context (nor any way to know which Feign client is being built).
My suggestion
So, I propose to put in the current context the FeignClientFactoryBean which uses it.
A temporary solution
For those who have the same use case as me, you can find the name of the client being built with this not very elegant trick:
My goal
I want to be able to declare a feign.Client bean (the http one) for each feign client. Furthermore, I want these feign.Client to be customized for each feign client.
How I achieved this
The feign.Client is retrieved/produced by FeignClientFactoryBean@L486.
If I have a configuration that produces feign.Client in the context used by FeignClientFactoryBean then I will be able to control the feign.Client retrieved by FeignClientFactoryBean.
EnableFeignClients#defaultConfiguration
allows to do this so I declared this:As I need to know the client I am building so I add some injections:
The problem
The problem with this code is that
clientName
is always equal to the name of the first Feign client instantiated. This is because there is noFeignClientFactoryBean
in the current context (nor any way to know which Feign client is being built).My suggestion
So, I propose to put in the current context the
FeignClientFactoryBean
which uses it.A temporary solution
For those who have the same use case as me, you can find the name of the client being built with this not very elegant trick:
The text was updated successfully, but these errors were encountered: