On 29.10.2013 11:59, lbu wrote:
Hi,
I'm trying to figure-out which is the best option to configure a bean
instantiated via OSGi Blueprint and I have a some question for which I
haven't found the answer:
1) is there any way to reference to the cm:property-placeholder's
persistent-id? So I can write something like:
<cm:property-placeholder persistent-id="my.service.pid"
update-strategy="reload">
</cm:property-placeholder>
<bean id="my.bean.id" class="my.bean.Class">
<property name="servicePid" value="${persistent-id}"/>
</bean>
The persistent id is reflected as property ${service.pid}
2) is there any way to have the ConfigAdmin to call Class.update(Map ...)
when the bean is instantiated?
<cm:property-placeholder persistent-id="my.service.pid"
update-strategy="reload">
</cm:property-placeholder>
<bean id="my.bean.id" class="my.bean.Class">
</bean>
class my.bean.Class {
public void update(Map configuration) {
....
}
}
thx - Luca
Reload means that the whole context is reloaded when the config changes.
So it is not really an update but you can inject the whole map.
<cm:property-placeholder id="myConfig" persistent-id="my.service.pid"
update-strategy="reload">
</cm:property-placeholder>
<bean id="my.bean.id" class="my.bean.Class">
<property name="config" ref="myConfig"/>
</bean>
Christian
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com