簡體   English   中英

Spring Cloud Config客戶端在屬性文件中設置配置URL

[英]spring cloud config client set config url at property file

我有一個Spring Cloud項目。 有配置服務器(config-srv),尤里卡服務器(eureka-srv)和其他帶有業務邏輯的服務,我們稱其為主服務(main-srv)。

我將它們包裝到廣口瓶中,然后逐一運行。 我的應用程序從與jars相同目錄中的文件獲取屬性。

因此,我通過“ application-native.properties”將屬性設置為config-srv。

但是,如果我想更改config-srv URL(例如,我想要http:// localhost:9999 ),我如何在所有微服務啟動之前為所有微服務共享此URL? 我正在嘗試在“ application-default.properties”中共享此網址,但沒有任何效果。

您可以將Spring Cloud Config服務器詳細信息放在每個微服務的bootstrap.properties文件中。

spring.application.name=microserviceName
spring.profiles.active=dev
spring.cloud.config.uri=http://localhost:9999
spring.cloud.config.username=your_username
spring.cloud.config.password=your_password

瀏覽鏈接以獲取有關Spring Cloud Config的更多詳細信息https://howtodoinjava.com/spring-cloud/spring-cloud-config-server-git/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM