polish

parent 384c9b97
...@@ -237,10 +237,8 @@ class FeignClientsRegistrar implements ImportBeanDefinitionRegistrar, ...@@ -237,10 +237,8 @@ class FeignClientsRegistrar implements ImportBeanDefinitionRegistrar,
} }
private String resolve(String value) { private String resolve(String value) {
if (StringUtils.hasText(value) if (StringUtils.hasText(value)) {
&& this.resourceLoader instanceof ConfigurableApplicationContext) { return this.environment.resolvePlaceholders(value);
return ((ConfigurableApplicationContext) this.resourceLoader).getEnvironment()
.resolvePlaceholders(value);
} }
return value; return value;
} }
......
...@@ -20,6 +20,7 @@ package org.springframework.cloud.netflix.feign; ...@@ -20,6 +20,7 @@ package org.springframework.cloud.netflix.feign;
import java.util.Collections; import java.util.Collections;
import org.junit.Test; import org.junit.Test;
import org.springframework.mock.env.MockEnvironment;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
...@@ -70,6 +71,7 @@ public class FeignClientsRegistrarTests { ...@@ -70,6 +71,7 @@ public class FeignClientsRegistrarTests {
private String testGetName(String name) { private String testGetName(String name) {
FeignClientsRegistrar registrar = new FeignClientsRegistrar(); FeignClientsRegistrar registrar = new FeignClientsRegistrar();
registrar.setEnvironment(new MockEnvironment());
return registrar.getName(Collections.<String, Object>singletonMap("name", name)); return registrar.getName(Collections.<String, Object>singletonMap("name", name));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment