Fix issue 923 config url and feign annotation path
This commit is contained in:
committed by
Olga MaciaszekSharma
parent
bd5701d564
commit
4465795642
@@ -448,7 +448,6 @@ public class FeignClientFactoryBean
|
||||
if (StringUtils.hasText(url) && !url.startsWith("http")) {
|
||||
url = "http://" + url;
|
||||
}
|
||||
String url = this.url + cleanPath();
|
||||
Client client = getOptional(feignClientFactory, Client.class);
|
||||
if (client != null) {
|
||||
if (client instanceof FeignBlockingLoadBalancerClient) {
|
||||
@@ -489,7 +488,7 @@ public class FeignClientFactoryBean
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private <T> HardCodedTarget<T> resolveTarget(FeignClientFactory context, String contextId, String url) {
|
||||
if (StringUtils.hasText(url)) {
|
||||
return new HardCodedTarget(type, name, url);
|
||||
return new HardCodedTarget(type, name, url + cleanPath());
|
||||
}
|
||||
|
||||
if (refreshableClient) {
|
||||
@@ -505,7 +504,7 @@ public class FeignClientFactoryBean
|
||||
"Provide Feign client URL either in @FeignClient() or in config properties.");
|
||||
}
|
||||
|
||||
return new PropertyBasedTarget(type, name, config);
|
||||
return new PropertyBasedTarget(type, name, config, cleanPath());
|
||||
}
|
||||
|
||||
private boolean isUrlAvailableInConfig(String contextId) {
|
||||
|
||||
@@ -33,15 +33,19 @@ public class PropertyBasedTarget<T> extends Target.HardCodedTarget<T> {
|
||||
|
||||
private final FeignClientProperties.FeignClientConfiguration config;
|
||||
|
||||
public PropertyBasedTarget(Class<T> type, String name, FeignClientProperties.FeignClientConfiguration config) {
|
||||
private final String path;
|
||||
|
||||
public PropertyBasedTarget(Class<T> type, String name, FeignClientProperties.FeignClientConfiguration config,
|
||||
String path) {
|
||||
super(type, name, config.getUrl());
|
||||
this.config = config;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String url() {
|
||||
if (url == null) {
|
||||
url = config.getUrl();
|
||||
url = config.getUrl() + path;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user