Spring 2.0.7....
I have business logic ClasssA and ClassB, they are circular reference, but I'm not to use constructor injection and stick to setter injection only.
If I add the <aop:config> segment like below, thire's a BeanCurrentlyInCreationException like this:
But If remove the <aop:config> segment, it works.org.springframework.beans.factory.BeanCurrentlyInC reationException: Error creating bean with name 'channelBO': Bean with name 'channelBO' has been injected into other beans [MetaPageBO] in its raw version as part of a circular reference, but has eventually been wrapped (for example as part of auto-proxy creation). This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
Why? Could any one give me a hand?
The application context:Code:ClassA { ClassB classB; setClassB(); getClassB(); } ClassB { ClassA classA; setClassA(); getClassA(); }
Code:<aop:config proxy-target-class="true"> <aop:pointcut id="txPointcut" expression="execution(* Class*(..))"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/> </aop:config> <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="add*" rollback-for="Exception"/> <tx:method name="insert*" rollback-for="Exception"/> <tx:method name="create*" rollback-for="Exception"/> <tx:method name="update*" rollback-for="Exception"/> <tx:method name="edit*" rollback-for="Exception"/> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice> <bean id="classA" class="ClassA"> <property name="classB" ref="classB"/> </bean> <bean id="classB" class="ClassB"> <property name="classA" ref="classA"/> </bean>



Reply With Quote