spring.application.name 不起作用,并且仅显示注册为配置默认的服务,而不是自定义服务名称

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

在我的 application.properties 文件中,我设置了 spring.application.name = CART-SERVICE 但在尝试将其注册到 eureka 服务器时,它显示为 CONFIG-DEFAULT 而不是 CART-SERVICE。我正在使用 git 来保存配置。

Attached Screenshot of eureka server

我尝试使用 spring.config.name 但它也给了我相同的结果。

我应该怎么做才能使服务名称显示在服务器上,而不是仅仅注册为 CONFIG-DEFAULT。

spring-boot microservices spring-cloud-config
1个回答
0
投票

这个名字要添加到 bootstrap.properties 文件而不是 application.properties。

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