Can you show a complete example of your configuration. The part you posted misses some referenced beans.
We had the same issue and it had to do with the order the beans are loaded. Sometimes the ProxyFactoryBean gets created BEFORE the actual target is created. Weird case but it happens.
Our solution was to create a ExtendProxyFactoryBean which had a constructor which took the target(Source) as a parameter. This appears to resolve the ordering issue. Notice that we had to place it inside the org.springframework.aop.framework package.
Code:
package org.springframework.aop.framework;
import org.springframework.aop.TargetSource;
/**
* Workaround for Spring's initialization issues in combination with Spring 2.0 AOP.
* Specifically placed in the org.springframework.aop.framework package because
* it needs access to the package protected <code>targetSource</code> field to set it.
*
*/
public class ExtendedProxyFactoryBean extends ProxyFactoryBean {
public ExtendedProxyFactoryBean(TargetSource target) {
super();
this.targetSource=target;
}
}
Some example configuration
Code:
<bean id="library" class="org.springframework.aop.framework.ExtendedProxyFactoryBean">
<constructor-arg ref="libraryService"/>
<property name="proxyInterfaces">
<value>library.Service</value>
</property>
<property name="interceptorNames">
<list>
<value>libraryServiceInterceptor</value>
</list>
</property>
</bean>