diff --git a/client/pom.xml b/client/pom.xml index bf82281..fb9bbf5 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -34,11 +34,11 @@ org.springframework.cloud - spring-cloud-starter-feign + spring-cloud-starter-openfeign org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client org.springframework.boot diff --git a/client/src/main/java/demo/HelloClientApplication.java b/client/src/main/java/demo/HelloClientApplication.java index 1131de6..82f305e 100644 --- a/client/src/main/java/demo/HelloClientApplication.java +++ b/client/src/main/java/demo/HelloClientApplication.java @@ -4,8 +4,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.netflix.feign.EnableFeignClients; -import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/pom.xml b/pom.xml index 55e0f38..e62f73d 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.2.RELEASE + 2.0.4.RELEASE @@ -33,7 +33,7 @@ org.springframework.cloud spring-cloud-dependencies - Camden.BUILD-SNAPSHOT + Finchley.SR1 pom import diff --git a/server/pom.xml b/server/pom.xml index 0502fa7..696c425 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -34,11 +34,11 @@ org.springframework.cloud - spring-cloud-starter-feign + spring-cloud-starter-openfeign org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client org.springframework.boot diff --git a/server/src/main/java/demo/HelloServerApplication.java b/server/src/main/java/demo/HelloServerApplication.java index 08d09fa..0929b46 100644 --- a/server/src/main/java/demo/HelloServerApplication.java +++ b/server/src/main/java/demo/HelloServerApplication.java @@ -1,5 +1,7 @@ package demo; +import java.util.List; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -21,8 +23,15 @@ public class HelloServerApplication { @RequestMapping("/") public String hello() { - ServiceInstance localInstance = client.getLocalServiceInstance(); - return "Hello World: "+ localInstance.getServiceId()+":"+localInstance.getHost()+":"+localInstance.getPort(); + StringBuilder result = new StringBuilder("Hello World: "); + List services = client.getServices(); + for(String serviceId: services) { + List localInstances = client.getInstances(serviceId); + for(ServiceInstance instance: localInstances) { + result.append(instance.getServiceId()+":"+instance.getHost()+":"+instance.getPort()); + } + } + return result.toString(); } public static void main(String[] args) {