Skip to content

BeanCurrentlyInCreationException is thrown when there are circular references between aop-proxied references [SPR-4566] #9243

@spring-projects-issues

Description

@spring-projects-issues

Morten Andersen-Gott opened SPR-4566 and commented

Using the applicationContext below, BeanCurrentlyInCreationException is thrown on application startup. If I remove the aop-config element, the application starts fine and I am able to execute both services.

The use of aop on both components seems perfectly legit to me, especially if the aspects are performing logging. The issue has been raised in several threads in the forum as well:
http://forum.springframework.org/showthread.php?p=168972
http://forum.springframework.org/showthread.php?t=45411

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

<bean id="serviceA" class="com.test.ServiceAImpl">
	<property name="serviceB" ref="serviceB"/>
</bean>

<bean id="serviceB" class="com.test.ServiceBImpl">
	<property name="serviceA" ref="serviceA"/>
</bean>	

<bean id="traceInterceptor" class="com.test.TraceInterceptor">
</bean>	

<aop:config>
	<aop:pointcut id="allServiceMethods" expression="execution(* com.test..*.*(..))"/>
	<aop:advisor advice-ref="traceInterceptor" pointcut-ref="allServiceMethods" />
</aop:config>	

</beans>


Affects: 2.0.7, 2.5.2

Attachments:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions