No instances available for service-helloworld

問題描述:No instances available for service-helloworld

客戶端註冊不到註冊中心,所以找不到對應的實例

解決方案

  1. 客戶端加入依賴
<dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-starter-eureka</artifactId>
   <version>1.4.5.RELEASE</version>
</dependency>

    2. 加入依賴之後springboot還要開啓健康檢查

   eureka.client.healthcheck.enabled=true

並且加入依賴

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

    3. 客戶端啓動之後能在註冊中心看到實例纔算啓動成功

4 這樣就可以用客戶端遠程調用服務端的方法了