springDM配置管理批量属性更改

时间:2012-02-29 12:14:23

标签: java spring osgi eclipse-virgo

所以,我有springDM托管属性

<beans:beans xmlns="http://www.springframework.org/schema/osgi-compendium"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
xsi:schemaLocation="
  http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd
  http://www.springframework.org/schema/osgi-compendium 
    http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">

<beans:bean id="configurationBean" class="com.eugene.PropertiesBean">
    <osgix:managed-properties persistent-id="MyPid" update-strategy="container-managed"/>
    <beans:property name="host" value="localhost"></beans:property>
    <beans:property name="port" value="5698"></beans:property>
</beans:bean>
</beans:beans>

现在,这就是我的工作。将软件包部署到Virgo,一切运行良好,默认属性(因为未部署MyPid.properties)被注入到bean中。

部署MyPid.properties,其中BOTH主机和端口都被更改,它们也被重新注入。

那很好。但事情就是这样,我可以用一种方法告诉我豆子已经改变了吗?这些属性已被重新注入?类似于:在XML配置中的afterPropertiesSet或init?因为现在有一个afterPropertiesSet或init只在第一次注入属性时工作,而不是第二次,第三次等等......这就是某种逻辑。

如果Spring DM提供这样的话,我不知道(googleed)。

THX!尤金。

1 个答案:

答案 0 :(得分:0)

实际上这是一个已知问题。我们不得不切换到bean管理的更新。