反映 OSGi bundle中的属性文件更改,而无需重新启动 Karaf 服务器



我如何配置我的 Karaf 服务器,以便每当属性文件发生更改时,我都不应该重新启动我的服务器以获取这些更改 staead 它应该原子地检测这些更改。我在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 机制来装入属性文件。据我所知,您只能通过从弹簧切换到蓝图来实现这一点。

在蓝图中,您可以定义如下配置:

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

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

相关内容

最新更新