在osgi捆绑包中反映属性文件更改,而无需重新启动Karaf服务器

在osgi捆绑包中反映属性文件更改,而无需重新启动Karaf服务器,osgi,apache-karaf,jbossfuse,Osgi,Apache Karaf,Jbossfuse,我如何配置我的Karaf服务器,使其无论何时属性文件发生更改,我都不应该重新启动服务器以获取staead中的更改,它应该自动检测这些更改。我正在osgi Karaf服务器中部署我的包。对于加载属性文件,我在骆驼上下文中使用以下配置 <bean class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer" id="properties"> <property name="locations"&g

我如何配置我的Karaf服务器,使其无论何时属性文件发生更改,我都不应该重新启动服务器以获取staead中的更改,它应该自动检测这些更改。我正在osgi Karaf服务器中部署我的包。对于加载属性文件,我在骆驼上下文中使用以下配置

<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> 

文件:etc/app/properties/env/env.properties
文件:etc/vrol/security/ssl.properties

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

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

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


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

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

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

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


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

谢谢@christian schneider,但我使用的是Spring DSL。你的意思是不可能让同样的东西在SpringDSL上工作吗?还有一个蓝图DSL几乎与SpringDSL相同。是的,那么我如何在SpringDSL中实现这一点呢?我是否必须更改加载我的属性的方式,即当前我正在使用BridgePropertyPlaceholder。如果那样的话,你能告诉我怎么才能看到这个吗。将Blueprint属性占位符与Camel RoutesTanks@christian schneider一起使用,但我使用的是Spring DSL。你的意思是不可能让同样的东西在SpringDSL上工作吗?还有一个蓝图DSL几乎与SpringDSL相同。是的,那么我如何在SpringDSL中实现这一点呢?我是否必须更改加载我的属性的方式,即当前我正在使用BridgePropertyPlaceholder。如果那样的话,你能告诉我怎么才能看到这个吗。将Blueprint特性占位符用于驼峰路线