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 found after some debugging that contrary to the situation described in that ticket, if ApacheHttpClient is on the classpath (in my case through a dependency on io.github.openfeign:feign-httpclient), it is very well possible to specify an empty String for the url in a @FeignClient (in my case, I did it like this: @FeignClient(name = "myfeignclient", url = "${my.url:}"), i.e. with an empty String as default value and the property being absent).
This allows the context to come up at least and will only result in an UnknownHostException when a request is actually attempted to be sent through that FeignClient.
For us, this is quite convenient though in a development environment where the destination is not known or when working on someone else's project so not all the required configuration needs to be known.
The crucial difference seems to be in the method loadBalance in FeignClientFactoryBean. Without the ApacheHttpClient being available as a bean, getOptional returns null, leading to the IllegalStateException.
A bean of type ApacheHttpClient seemingly becomes registered through FeignAutoConfiguration.HttpClientFeignConfiguration.
I'm thinking that if the Client.Default implementation was exposed as a bean, both situations would behave the same.
Would this be a reasonable change? I read @OlgaMaciaszek's point on the other ticket that it is intended to fail(?) by design, but why should it work then with ApacheHttpClient? (please don't take away that possibility though, like I said above, we like it 😉)
The text was updated successfully, but these errors were encountered:
@jo-ka, you're right - the behaviour is not consistent and adding a Client bean could be done, however, I don't think it would bring a lot of functionality improvement, so will leave it is at is for now, unless we get more requests about it from the community.
My issue is related to #517.
I found after some debugging that contrary to the situation described in that ticket, if
ApacheHttpClient
is on the classpath (in my case through a dependency onio.github.openfeign:feign-httpclient
), it is very well possible to specify an empty String for theurl
in a@FeignClient
(in my case, I did it like this:@FeignClient(name = "myfeignclient", url = "${my.url:}")
, i.e. with an empty String as default value and the property being absent).This allows the context to come up at least and will only result in an
UnknownHostException
when a request is actually attempted to be sent through that FeignClient.For us, this is quite convenient though in a development environment where the destination is not known or when working on someone else's project so not all the required configuration needs to be known.
The crucial difference seems to be in the method
loadBalance
inFeignClientFactoryBean
. Without theApacheHttpClient
being available as a bean,getOptional
returnsnull
, leading to theIllegalStateException
.A bean of type
ApacheHttpClient
seemingly becomes registered throughFeignAutoConfiguration.HttpClientFeignConfiguration
.I'm thinking that if the
Client.Default
implementation was exposed as a bean, both situations would behave the same.Would this be a reasonable change? I read @OlgaMaciaszek's point on the other ticket that it is intended to fail(?) by design, but why should it work then with
ApacheHttpClient
? (please don't take away that possibility though, like I said above, we like it 😉)The text was updated successfully, but these errors were encountered: