"eurekaHealthIndicator" netflix eureka 客户端问题

"eurekaHealthIndicator" issue with netflix eureka client

尝试使用 Spring Cloud Netflix v1.2 编写 Eureka 客户端。0.Release 但面临下面提到的问题。 PFB代码和配置。

EurekaClient.java

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


    @Configuration
    @EnableAutoConfiguration
    @EnableEurekaClient
    @RestController
    @ComponentScan(basePackages={"com.west.eas.netflix.config"})
    public class EurekaClient {

        @RequestMapping("/")
          public String home() {
            return "Hello World";
          }

          public static void main(String[] args) {
              new SpringApplicationBuilder(EurekaClient.class).run(args);
          }


    }

application.yml

server:  
  port: 9000

spring:  
  application:
    name: eas-eureka-client

eureka:  
  client:
    healthcheck:
      enabled: true
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
  instance:
    preferIpAddress: true

bootstrap.yml

spring:
  application:
    name: eu-client
  cloud:
    config:
      uri: http://localhost:8888
encrypt:
  failOnError: false

客户端启动失败,出现以下错误

" Parameter 0 of method eurekaHealthIndicator in org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration$EurekaHealthIndicatorConfiguration required a bean of type 'com.netflix.discovery.EurekaClient' that could not be found."

下面的屏幕截图将包含有关错误堆栈的更多详细信息

我什至尝试在 application.yml 中将 healthcheck enable 设置为 false,但它仍然不起作用。任何帮助将不胜感激。

此致

问题似乎是你正在命名你的客户端EurekaClient,已经有一个同名的bean。将 class 重命名为其他名称,它应该可以工作

正如@spencergibb 提到的,它在添加依赖项时确实出错了,我尝试通过 http://start.spring.io/ 创建一个新项目,这解决了我的问题。