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:
But when I run it, I got an exception sayingCode:<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 after I took a look at the test suites that came along with Spring and tried:Code:FactoryBean threw exception on object creation; nested exception is org.springframework.aop.framework.AopConfigException: Target name cannot be null when refreshing!
it's running back properly again.Code:<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>
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


Reply With Quote