首页 文章

无法向发现服务器注册服务(EUREKA)

提问于
浏览
2

所以当我运行我的服务实例时 . 它不会将自己注册到发现服务器 . 并且没有错误,因此我无法在此处识别问题 .

application.properties 我的服务看起来像这样,发现服务器的 application.properties 可以在附带的屏幕截图中看到 .

spring.application.name = service
eureka.client.service-url.defaultZone =http://localhost:8761/eureka/

localhost上的Eureka仪表板:8761表示此服务没有可用的实例 .

1 回答

  • 2

    您必须在 pom.xml 中添加此依赖项,这将为您的服务提供一个保持原状的理由:

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

    此外,我认为您应该为Eureka默认区域部分重构 application.properties 文件,如下所示:

    eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
    eureka.instance.preferIpAddress=true
    eureka.client.registerWithEureka=true
    eureka.client.fetchRegistry=true
    

相关问题