Spring 是bean';a';还是单身的春天?
在下面的例子中会发生什么?类A仍然是单例对象吗Spring 是bean';a';还是单身的春天?,spring,singleton,Spring,Singleton,在下面的例子中会发生什么?类A仍然是单例对象吗 <bean id="a" class="A" singleton="true"> <property name="b"> <ref bean="b"/> </property> </bean> <bean id="b" class="B" singleton="false"/> 是的。的bean实例是一个单例对象。 然而,考虑到
<bean id="a" class="A" singleton="true">
<property name="b">
<ref bean="b"/>
</property>
</bean>
<bean id="b" class="B" singleton="false"/>
是的。的bean实例是一个单例对象。 然而,考虑到BeanB虽然不是单例,但同一个b实例将绑定到a单例对象。 如果另一个单例对象具有b实例,则该b实例应不同