0

だから、私は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 が変更されたことを通知するメソッドを 1 つだけ持つことはできますか? プロパティが再注入されましたか? 次のようなもの: afterPropertiesSet または XML 構成の init? 現在、 afterPropertiesSet または init を持つことは、プロパティが最初に注入されたときにのみ機能し、2 回目、3 回目などでは機能しないためです...これはどういうわけか論理です。

春のDMがそのようなものを提供しているかどうかはわかりません(グーグルで調べました)。

どうも!ユージーン。

4

1 に答える 1

0

これは実際には既知の問題です。Bean 管理の更新に切り替える必要がありました。

于 2012-03-02T08:07:12.653 に答える