|
From: James C. <jim...@do...> - 2004-05-11 23:25:21
|
I'm experiencing a problem with the order that my beans are wired together. I have an SAO bean (id=SecuritySAO) and it is a singleton. I want this bean to be advised by a BeanNameAutoProxyCreator so it will be control transactions. I also want this bean to be wired into another BeanPostProcessor class I wrote called SAOAware. The problem is that the SecuritySAO bean is created initially be the SAOAware bean because it is a property of the latter. This means that the AutoProxy bean has not yet had an opportunity to work its magic on the bean and proxy it. When I use the SAOAware bean, the SecuritySAO object is not proxied and not weaved into the transation interceptor. I have tried to use the depends-on to cause the AutoProxy to instrument the bean first, but it didn't make any difference. I have also used the ordered property of both post processors without any effect also. Am I missing something else? <bean id="SecuritySAO" class="my.SecuritySAOImpl" /> <bean id="AutoProxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" > <property name="proxyTargetClass"><value>true</value></property> <property name="order"><value>1</value></property> <property name="interceptorNames"> <list> <idref local="transactionInterceptor"/> </list> </property> <property name="beanNames"> <list> <idref local="jpp.SecuritySAO"/> </list> </property> </bean> <bean id="SAOAware" class="my.spring.AutowireByInterface" depends-on="AutoProxy"> <property name="order"><value>100</value></property> <property name="interface"><value>my.SAOAware</value></property> <property name="property"><value>securitySAO</value></property> <property name="value"><ref bean="SecuritySAO" /></property> </bean> |