【问题标题】:include properties in another properties file在另一个属性文件中包含属性
【发布时间】: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


    【解决方案1】:

    在您的路线中,您可以使用以下语法:

    ${properties:bar.end?locations=com/mycompany/bar.properties}
    

    在您的实际属性文件中,我不确定是否可能。

    R.

    【讨论】:

      猜你喜欢
      • 2017-01-29
      • 2015-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-06
      相关资源
      最近更新 更多