【发布时间】:2016-08-24 10:26:57
【问题描述】:
首先,我为我的近似英语道歉;)
我像这样在 xml 中加载两个属性文件
<propertyPlaceholder id="properties"
location="path/to/my/properties/folder/file2.properties,
path/to/my/properties/folder/file1.properties"/>
我的属性文件如下所示:
file1.properties
endpoint-from=rest:post:useraccounts:
endpoint-to=http4://${host}:${port}/endpoint
file2.properties(示例中的模拟变量)
host=0.0.0.0
host=9999
是的,我们谈论骆驼路由 (v2.17)
当我启动我的应用程序时,我似乎没有填充变量主机和端口。是否可以这样做,在特定属性文件中使用另一个属性文件中的变量?
我为什么要这样做?我有多个配置文件调用了两个或三个外部服务,如果我的主机发生变化(迁移,不同的环境),只更改 file2 中的主机变量而不是更改所有其他文件中的所有主机更容易(我有超过声明了 60 个端点。
我希望我足够清楚以使自己理解,我希望你能并且会帮助我
【问题讨论】:
标签: xml properties configuration properties-file