在SPRING中,有两个BEAN 一个抽象类 一个子类,
如果想在抽象类中注入子类,如何实现?
下面这种方式会报错:
<!-- 抽象类 -->
<bean id ="abstractBO" abstract="true" class="com.xxxx.abcd.AbstractBOImpl">
<property name="subBO">
<ref bean="subBO"/>
</property>
</bean>
<!-- 子类 -->
<bean id ="subBO" class="com.xxxx.abcd.Sub" parent="abstractBO"/>
Error creating bean with name 'subBO': Bean with name 'subBO' has been injected into other beans [subBO] 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.