cptechno
Oct 1st, 2004, 08:47 PM
Hi,
Using Spring 1.1.
I'm using a ProxyFactoryBean to add advices to my target, which is required to not be a singleton.
After reading the docs I tried:
<bean id="UploadNewFileAction" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="singleton"><value>false</value></property>
<property name="proxyTargetClass"><value>true</value></property>
<property name="interceptorNames">
<list>
<value>FileUploadAdvice</value>
<value>FileExtractContentAdvice</value>
<value>FileSubjectTopicNatureAdvice</value>
</list>
</property>
<property name="target"><ref local="_uploadFileAction" /></property>
</bean>
<bean name="_uploadFileAction" class="my.UploadFileAction"/>
But when I run it, I got an exception saying
FactoryBean threw exception on object creation; nested exception is org.springframework.aop.framework.AopConfigExcepti on: Target name cannot be null when refreshing!
But after I took a look at the test suites that came along with Spring and tried:
<bean id="UploadNewFileAction" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="singleton"><value>false</value></property>
<property name="proxyTargetClass"><value>true</value></property>
<property name="interceptorNames">
<list>
<value>FileUploadAdvice</value>
<value>FileExtractContentAdvice</value>
<value>FileSubjectTopicNatureAdvice</value>
<value>_uploadFileAction</value>
</list>
</property>
</bean>
it's running back properly again.
I wonder why? :?: Because _uploadFileAction should be defined as the target of the ProxyFactoryBean instead of one of the members of the interceptor stack.
TIA,
Raymond
Using Spring 1.1.
I'm using a ProxyFactoryBean to add advices to my target, which is required to not be a singleton.
After reading the docs I tried:
<bean id="UploadNewFileAction" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="singleton"><value>false</value></property>
<property name="proxyTargetClass"><value>true</value></property>
<property name="interceptorNames">
<list>
<value>FileUploadAdvice</value>
<value>FileExtractContentAdvice</value>
<value>FileSubjectTopicNatureAdvice</value>
</list>
</property>
<property name="target"><ref local="_uploadFileAction" /></property>
</bean>
<bean name="_uploadFileAction" class="my.UploadFileAction"/>
But when I run it, I got an exception saying
FactoryBean threw exception on object creation; nested exception is org.springframework.aop.framework.AopConfigExcepti on: Target name cannot be null when refreshing!
But after I took a look at the test suites that came along with Spring and tried:
<bean id="UploadNewFileAction" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="singleton"><value>false</value></property>
<property name="proxyTargetClass"><value>true</value></property>
<property name="interceptorNames">
<list>
<value>FileUploadAdvice</value>
<value>FileExtractContentAdvice</value>
<value>FileSubjectTopicNatureAdvice</value>
<value>_uploadFileAction</value>
</list>
</property>
</bean>
it's running back properly again.
I wonder why? :?: Because _uploadFileAction should be defined as the target of the ProxyFactoryBean instead of one of the members of the interceptor stack.
TIA,
Raymond