Skip to content

Instantly share code, notes, and snippets.

@rand0m86
Created February 11, 2015 11:16
Show Gist options
  • Save rand0m86/9535b97377198d3b64a8 to your computer and use it in GitHub Desktop.
Save rand0m86/9535b97377198d3b64a8 to your computer and use it in GitHub Desktop.
Spring circular dependency resolution
<bean id="serviceA" class="com.ServiceA" lazy-init="true">
<property name="serviceB" ref="serviceB"/>
</bean>
<bean id="serviceB" class="com.ServiceB">
<property name="serviceA" ref="serviceAProxy"/>
</bean>
<bean id="serviceAProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="targetSource">
<bean class="org.springframework.aop.target.LazyInitTargetSource">
<property name="targetBeanName">
<idref bean="serviceA"/>
</property>
</bean>
</property>
</bean>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment