Using spring-cloud-openfeign version 2.1.5-RELEASE
set the placeholder in url attribute.
@FeignClient(name = "${feign.name}", url = "${feign.url}")
public interface StoreClient {
//..
}
I specify the feign.url in the configServer.and It always adds "http://"prefix to the left of the string,the final url is like:http://https://example.com. But if I specify the url in a properties file, it works just fine.
I checked the source code in FeignClientsRegistrar class and I found that
static String getUrl(String url) {
if (StringUtils.hasText(url) && (!url.startsWith("#{") || !url.contains("}"))) {
if (!url.contains("://")) {
url = "http://" + url;
}
try {
new URL(url);
} catch (MalformedURLException var2) {
throw new IllegalArgumentException(url + " is malformed", var2);
}
}
return url;
}
How can I fix it?
Comment From: masquerader1
https://github.com/spring-cloud/spring-cloud-netflix/issues/2684