“Eureka-Server”在运行“Spring Cloud Config Server”时看不到其属性

问题描述 投票:0回答:1

在“Eureka-Server”中,“application.properties”文件包含以下属性:

spring.config.import=configserver:http://localhost:8888
spring.application.name=eserver

我的“Spring Cloud Config Server”在其 application.properties 文件中有以下属性:

server.port=8888
spring.application.name=spring-cloud-config-server
spring.cloud.config.server.git.uri=file:///D:/<path-to-folder>/config-repo
spring.cloud.config.server.git.default-label=main
spring.profiles.active=native

“config-repo”文件夹包含一个“server”文件夹,其中包含具有以下属性的“application.properties”文件:

server.port=8761
spring.application.name=eserver
eureka.client.service-url.defaultZone=http://localhost:8761/eureka
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false

所以,当我运行“spring-cloud-config-server”(配置服务器)时,一切都正常,我没有看到错误或警告。 但是当我尝试运行我的“Eureka-Server”(eserver)时,它在端口 8080 上启动并抛出如下错误:

Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}, exception=java.net.ConnectException: Connection refused: no further information stacktrace=jakarta.ws.rs.ProcessingException: java.net.ConnectException: Connection refused: no further information

因此,eureka-server 无法从 config-server 读取自己的属性。我做错了什么?

附注如果我将“config-repo server pplication.properties”中的所有属性放回到 eureka-server 的“application.properties”中,那么一切都很好。但我想将配置提取到配置服务器。

附注“spring-boot版本”是3.2.1,“spring-cloud版本”是2023.0.0

java microservices spring-cloud netflix-eureka spring-cloud-config
1个回答
0
投票

所以,问题出在与配置服务器本地存储库的连接上。如果我使用远程 GitHub 存储库,Eureka-server 可以正常工作。但我仍然不知道如何将配置服务器连接到本地存储库..

© www.soinside.com 2019 - 2024. All rights reserved.