apache-camel - Camel 2.X.X : Put property file(. cfg) 在 etc 目录的子目录中使用 cm:property-placeholder 加载属性

标签 apache-camel apache-karaf blueprint-osgi

蓝图.xml

<cm:property-placeholder persistent-id="client.service"
    update-strategy="reload">
    <cm:default-properties>
        <cm:property name="URI"
            value="https://blabla/" />
        <cm:property name="ConnectionTimeout" value="18000" />
        <cm:property name="ResponseTimeout" value="10000" />
    </cm:default-properties>
</cm:property-placeholder>

<bean id="configData"
    class=" com.myproject.ConfigurationData">
    <property name="URI" value="${URI}" />
    <property name="ConnectionTimeout" value="${ConnectionTimeout}" />
    <property name="ResponseTimeout" value="${ResponseTimeout}" />
</bean>

默认情况下,我需要将 client.service.cfg 文件放在 ${karaf.home}/etc 目录中,但是 我想要 etc 目录的子目录中的 client.service.cfg 文件。例如 ${karaf.home}/etc/client1/

最佳答案

最后,我们决定更改servicemix的配置,通过以下方式从多个位置读取配置(.cfg)文件。

在 etc 文件夹本身的 config.properties 文件中更新属性 felix.fileinstall.dir 的值。例如。

 felix.fileinstall.dir = ${karaf.base}/etc,${karaf.base}/etc/client1

因此,现在 servicemix 将从 etc 以及 atc/client1 目录读取并动态重新加载属性。

关于apache-camel - Camel 2.X.X : Put property file(. cfg) 在 etc 目录的子目录中使用 cm:property-placeholder 加载属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30589006/

相关文章:

java - 提取 URI 后缀作为方法参数

java - 保证将请求发送到 Web 服务

java - Osgi - Virgo 3.6 - 加载应用程序上下文

java - 在运行时访问 OSGi 包中的 pom 属性

java - 在每个类使用的 OSGi Karaf 和 Blueprint 中重新加载 .cfg 文件的内容

java - Camel 使用没有聚合器的分离器

spring - @CamelSpringTest 和@CamelSpringBootTest 有什么区别?

java - 如何在maven项目中忽略从部署到karaf的一个包

java - Camel jdbc : How can I reset datasource if mysql connection gets closed

java - Karaf 中的 XML 解析器类加载问题