Commit 880efd18 by Dave Syer

Remove @AliasFor from @FeignClient.serviceId()

The way it was being used internally means that we didn't need the annotation anyway. It would be nice to have it back if the Spring issue gets resolved, because then we could actually use it as intended. Fixes gh-1025
parent 9823d078
...@@ -52,9 +52,11 @@ public @interface FeignClient { ...@@ -52,9 +52,11 @@ public @interface FeignClient {
* @deprecated use {@link #name() name} instead * @deprecated use {@link #name() name} instead
*/ */
@Deprecated @Deprecated
@AliasFor("value")
String serviceId() default ""; String serviceId() default "";
/**
* The service id with optional protocol prefix. Synonym for {@link #value() value}.
*/
@AliasFor("value") @AliasFor("value")
String name() default ""; String name() default "";
......
...@@ -18,6 +18,7 @@ package org.springframework.cloud.netflix.feign.beans; ...@@ -18,6 +18,7 @@ package org.springframework.cloud.netflix.feign.beans;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
import java.util.Map;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -28,6 +29,8 @@ import org.springframework.boot.builder.SpringApplicationBuilder; ...@@ -28,6 +29,8 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.WebIntegrationTest; import org.springframework.boot.test.WebIntegrationTest;
import org.springframework.cloud.netflix.feign.EnableFeignClients; import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
...@@ -61,6 +64,9 @@ public class FeignClientTests { ...@@ -61,6 +64,9 @@ public class FeignClientTests {
private TestClient testClient; private TestClient testClient;
@Autowired @Autowired
private ApplicationContext context;
@Autowired
private org.springframework.cloud.netflix.feign.beans.extra.TestClient extraClient; private org.springframework.cloud.netflix.feign.beans.extra.TestClient extraClient;
@Configuration @Configuration
...@@ -90,6 +96,14 @@ public class FeignClientTests { ...@@ -90,6 +96,14 @@ public class FeignClientTests {
} }
@Test @Test
public void testAnnnotations() throws Exception {
Map<String, Object> beans = this.context
.getBeansWithAnnotation(FeignClient.class);
assertTrue("Wrong clients: " + beans,
beans.containsKey(TestClient.class.getName()));
}
@Test
public void testClient() { public void testClient() {
assertNotNull("testClient was null", this.testClient); assertNotNull("testClient was null", this.testClient);
assertNotNull("testClient was null", this.extraClient); assertNotNull("testClient was null", this.extraClient);
......
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