|
From: James C. <jim...@do...> - 2004-05-12 14:04:36
|
A simpler example may be in order. <bean id="SAO" class="MySAO" /> <bean id="AutoProxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" > <property name="interceptorNames"> <list> <idref local="transactionInterceptor"/> </list> </property> <property name="beanNames"> <list> <idref local="SAO"/> </list> </property> </bean> <bean id="ClassThatUsesSAO" class="MyBusinessObject"> <property name="sao"><ref bean="SAO" /></property> </bean> The problem is that the "ClassThatUsesSAO" is noticed first be Spring, and Spring discovers that there is a property on this bean that uses the "SAO" bean. Spring then instantiates the SAO bean and sets the resulting value to the property on the "ClassThatUsesSAO". Unfortunately, the SAO bean is not auto proxied at this time, and never will be as far as the "ClassThatUsesSAO" is concerned. Is there any way to ensure that the autoproxy has a chance to advise the "SAO" bean prior to invoking setSao() on the "ClassThatUsesSAO"? |