我有一個簡單的駱駝應用程序包,將在Apache服務混合6.1下部署在Karaf 3.0.5中。配置文件被放置在etc/
目錄中(假設它被命名爲wf.cfg
)。我想在我的應用程序包中具有動態配置更改功能。因此,只要wf.cfg
中的任何內容發生更改,都可立即進行捆綁。爲此,我已經添加在下面我 blueprint.xml
動態配置加載在Karaf 3.0.5中的駱駝應用程序包
<cm:property-placeholder persistent-id="wf"
update-strategy="reload">
<cm:default-properties>
<cm:property name="env" value="local" />
</cm:default-properties>
</cm:property-placeholder>
<!-- a bean that uses a blueprint property placeholder -->
<bean id="configBean" class="com.jabong.orchestratorservice.basecomponent.config.ConfigBean">
<property name="env" value="${env}" />
</bean>
我現在面臨的問題是,如果update-strategy
設置爲reload
。然後它似乎在重新加載整個bean。
有人可以讓我知道有沒有辦法,我可以重新加載只有configBean
不是整個捆綁?如果我可以實現這一點,那麼我可以有一些靜態引用到configBean
內的配置變量,然後我的應用程序包可以使用它嗎?
完整的blueprint.xml
被放置here。
您可以請我指向「aries blueprint」/ camel文檔,其中介紹了「managed-properties」? – tuk
說實話,白羊座的文件真的很小/不推薦,而'託管屬性'不是藍圖的一部分,它是白羊座的延伸。但是,您可以檢查源代碼和測試,例如:https://github.com/apache/aries/blob/trunk/blueprint/blueprint-itests/src/test/resources/ManagedServiceFactoryTest.xml –