Spring Cloud配置服务器支持读取带有名称的属性文件${spring.application.name}.properties
。但是我的应用程序中有 2 个属性文件。
a.properties
b.properties
我可以让配置服务器读取这两个属性文件吗?
在配置服务器正在查看的 git 或文件系统中重命名属性文件。
a.properties -> <your_application_name>.properties
a.properties -> <your_application_name>-<profile-name>.properties
例如,如果您的应用程序名称是test
并且您正在运行您的应用程序dev
profile,下面两个属性会一起使用。
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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)