2017-05-13 77 views

回答

2

在您的配置服務器正在查看的git或文件系統中重命名屬性文件。

a.properties -> <your_application_name>.properties 
a.properties -> <your_application_name>-<profile-name>.properties 

例如,如果你的應用程序名稱是test和你在dev配置文件中運行你的應用程序,以下兩個屬性將一起使用。

test.properties 
test-dev.properties 

你也可以在你的配置客戶端的bootstrap.properties指定其他配置文件檢索像下面更多的屬性文件。例如,

spring: 
    profiles: dev 
    cloud: 
    config: 
     uri: http://yourconfigserver.com:8888 
     profile: dev,dev-db,dev-mq 

如果您指定像上面那樣,下面的所有文件將一起使用。

test.properties 
test-dev.properties 
test-dev-db.prpoerties 
test-dev-mq.properties 
+0

非常感謝。它讓我更深入瞭解 –

+3

你也可以做'spring.application.name = a,b' – spencergibb

相關問題