Skip to content

Cyclic references via ProxyFactoryBean throw an BeanCreationException [SPR-768] #5495

Closed
@spring-projects-issues

Description

@spring-projects-issues

Felix von Delius opened SPR-768 and commented

If You have a cyclic dependency between two components which are intercepted with a ProxyFactoryBean, an BeanCreationException is thrown. Without interceptors, the wireing works.

Here's an example of such a wireing:

<bean id="bla" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean id="blaTarget" class="wireing.BlaImpl">
<property name="fasl"><ref bean="fasl"></ref></property>
</bean>
</property>
<property name="proxyInterfaces"><value>wireing.Bla</value></property>
<property name="interceptorNames">
<list>
<value>loggingAdvice</value>
</list>
</property>
</bean>

<bean id="fasl"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean id="faslTarget" class="wireing.FaslImpl">
<property name="bla"><ref bean="bla"></ref></property>
</bean>
</property>
<property name="proxyInterfaces"><value>wireing.Fasl</value></property>
<property name="interceptorNames">
<list>
<value>loggingAdvice</value>
</list>
</property>
</bean>

A workaround for this issue is to use the <lookup-method name="getBla" bean="bla" /> instead of the property-tag for the dependency.


Affects: 1.1.5

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions