【问题标题】:springDM Configuration Admin bulk properties changespringDM Configuration Admin 批量属性更改
【发布时间】:2012-02-29 12:14:23
【问题描述】:

所以,我有 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 已经改变了吗?属性已重新注入?类似于: XML 配置中的 afterPropertiesSet 或 init?因为现在拥有 afterPropertiesSet 或 init 仅在第一次注入属性时才有效,而不是第二次、第三次等等……这在某种程度上是合乎逻辑的。

我不知道(谷歌搜索)spring DM 是否提供这样的东西。

谢谢!尤金。

【问题讨论】:

    标签: java spring osgi eclipse-virgo


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-10
      • 1970-01-01
      • 1970-01-01
      • 2021-05-31
      • 1970-01-01
      • 2023-03-16
      • 2012-05-19
      • 1970-01-01
      相关资源
      最近更新 更多