功能区客户端无法发现在尤里卡注册的微服务

Ribbon client not able to discover microservices registered with eureka

您好,我创建了两个微服务 1.spotparkin 和 2.spotparking2,它们已成功注册到 eureka 服务器,然后我创建了 ribbon 客户端并尝试使用应用程序名称 spotpaking 进行休息调用,这是我的应用程序名称在两个微服务的 application.yml 文件中给出,但我收到以下错误:

2016-10-16 13:28:35.177 ERROR 11304 --- [nio-7213-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in c ontext with path [] threw exception [Request processing failed; nested exception is org.springframework.web.client.ResourceAccessException: I/O error on GE T request for "http://spotparking/spotparking/pincode": spotparking; nested exception is java.net.UnknownHostException: spotparking] with root cause

java.net.UnknownHostException: spotparking at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_101]

ParkingSpot parkingSpot = restTemplate.exchange("http://spotparking/spotparking/{pincode}",HttpMethod.GET,null,new ParameterizedTypeReference<ParkingSpot>() {}, pincode).getBody();
        return new MessageWrapper<>(parkingSpot, "server called using eureka with rest template");

This is how it is comming up in eureka:  

源代码可在 https://github.com/focode/microservices2/

功能区中缺少@LoadBalanced 并且还添加了

client:
    serviceUrl:
      defaultZone: http://127.0.0.1:8761/eureka/
    lease:
      duration: 5

代码现在可以使用了,可以从我的 github 帐户中获取