Describe the bug A common scenario is to define a @FeignClient as such:

    @FeignClient(name = "myfeignclient", url = "${my.url}")
    public interface TestFeignClient {
        @GetMapping(value = "/test")
        public Map<String, String> test();
    }

Notice the url is resolved from a property. It also isn't to uncommon to have a configuration which resolves the property to the value of an environment variable:

my:
    url: ${MY_URL}

Now if MY_URL is defined as the empty string, you get this error message:

No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalancer?

Which is very misleading... when the real issue is that no url was defined. I'd suggest changing this line of code:

https://github.com/spring-cloud/spring-cloud-openfeign/blob/33f3841e740d4e873174788511c0b6bdb3fbe91b/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientFactoryBean.java#L352

To be:

if (Objects.isNull(url)) {

It would definitely have helped me out. To work around this issue, I've been adding custom conditional annotations which disable my feign client if the url property is missing or null (since @ConditionalOnProperty will trigger even if it is an empty string).

Comment From: OlgaMaciaszek

It is by design. If an empty url has been provided, we try resolving the instance with the LB.

Comment From: OlgaMaciaszek

However, will add an additional log line, saying no URL was resolved.

Comment From: brimworks

Thanks. Hopefully that extra logging will avoid the problems I had.

Comment From: michaldo

@OlgaMaciaszek, now warning is printed always, even when url is not defined, for example @FeignClient(name = "foo")