S_a_k_Uの日記みたいなDB

~サクゥーと呼ばないで~

org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreatorはSingleton?

Spring 2.0.3
複数のAutoProxyCreatorを定義した場合、最初にインスタンス化した、AutoProxyCreatorしか有効になっていないっぽいな。
パッケージ毎にApplicationContextを定義するような作り方をした場合、AutoProxyCreatorをアプリケーションレベルで定義して、継承した形(parent)で各パッケージのApplicationContextにAutoProxyCreatorを定義していた。
動作的には、パッケージ毎にAutoProxyCreatorのインスタンスができるような定義。

【applicationContext.xml】(アプリケーション用ApplicationContext、transactionInterceptorとaroundAdviceは別途定義)
<bean id="autoProxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
  <property name="interceptorNames">
    <list>
      <idref bean="transactionInterceptor"/>
    </list>
  </property>
</bean>

【applicationContext_x.xml】(xパッケージ用ApplicationContext、x.hogehogeは別途定義)
<bean id="autoProxy.x" parent="autoProxy">
  <property name="beanNames">
    <list>
      <value>x.hogehoge</value>
    </list>
  </property>
</bean>

【applicationContext_y.xml】(yパッケージ用ApplicationContext、y.mogemogeは別途定義)
<bean id="autoProxy.y" parent="autoProxy">
  <property name="beanNames">
    <list>
      <value>y.mogemoge</value>
    </list>
  </property>
</bean>

結局今まで通り、アプリケーションの設定に全てのパッケージのBeanを定義することでOKに。
アプリケーションレベル(Singleton)で定義したAutoProxyCreatorに全てのパッケージのBeanを定義しないとダメみたい。

【applicationContext.xml】
<bean id="autoProxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
  <property name="interceptorNames">
    <list>
      <idref bean="transactionInterceptor"/>
    </list>
  </property>
  <property name="beanNames">
    <list>
      <value>x.hogehoge</value>
      <value>y.mogemoge</value>
    </list>
  </property>
</bean>

キレイな依存関係を実現するのは遠いのぉ〜
Springの?DIの?AOPの?の思想ってそこはあんまり意識せんのかな?
それかAddする仕組みがどっかにあるんかも?