【问题标题】:reflect property file changes in osgi bundle without restarting Karaf Server在不重新启动 Karaf 服务器的情况下反映 osgi 包中的属性文件更改
【发布时间】:2017-10-25 18:11:02
【问题描述】:

我如何配置我的 Karaf 服务器,以便每当有属性文件更改时,我不应该重新启动我的服务器以获得这些更改,它应该自动检测这些更改。我在 osgi Karaf Server 中部署我的包。为了加载属性文件,我在骆驼上下文中使用以下配置。

<bean 
class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer" 
id="properties">
<property name="locations">
<list><value>file:etc/app/properties/env/env.properties</value>
<value>file:etc/vrol/security/ssl.properties
</value></list></property></bean> 

【问题讨论】:

    标签: osgi apache-karaf jbossfuse


    【解决方案1】:

    您当前没有使用 OSGi 机制来加载属性文件。据我所知,您只能通过从 spring 切换到 blueprint 来实现这一点。

    在蓝图中你可以这样定义一个配置:

    <cm:property-placeholder persistent-id="myconfig" update-strategy="reload" >
    </cm:property-placeholder>
    

    这将从 etc/myconfig.cfg 加载配置,并在配置更改时重新加载蓝图上下文。

    【讨论】:

    • 感谢@christian schneider,但我使用的是 Spring DSL。你的意思是不可能用 spring DSL 做同样的事情吗?
    • 还有一个和spring dsl几乎一模一样的蓝图dsl。
    • 是的,那么我如何在 Spring DSl 中实现这一点?我是否必须更改加载属性的方式,即目前我正在使用 BridgePropertyPlaceholder 。如果那么你能告诉我们如何才能做到这一点
    • camel.apache.org/using-propertyplaceholder.html。使用带有骆驼路线的蓝图属性占位符
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-28
    • 2011-05-26
    • 1970-01-01
    • 1970-01-01
    • 2020-04-04
    • 1970-01-01
    • 2021-08-31
    相关资源
    最近更新 更多