因此,我有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,它们也都会重新注入。
太好了。但问题是,我能用一个方法来告诉我bean已经改变了吗?属性被重新注入了吗?类似于: afterPropertiesSet或init in XML config?因为现在afterPropertiesSet或init只在第一次注入属性时起作用,而不是第二次、第三次等等……这是某种逻辑。
我不知道(谷歌搜索) spring DM是否提供了这样的东西。
谢谢!尤金。
发布于 2012-03-02 16:07:13
这实际上是一个已知的问题。我们不得不切换到bean管理的更新。
https://stackoverflow.com/questions/9498991
复制相似问题