我有一个Dao不是Singleton,如果其他对象从他身上延伸,是单身还是不单身?代码示例如果父对象不是单身人士,那么孩子是单身人士?
<bean id="dao" class="parentDao"
scope="prototype">
</bean>
<bean id="childrenDao"
class="some.dao.extends.parentDao"
parent="parentDao">
</bean>
孩子们是单身吗?
我不确定您的测试,但是参考文档指出范围未被覆盖,但始终取自子定义。另见http://forum.spring.io/forum/spring-projects/container/30772-does-scope-prototype-in-a-parent-bean-apply-to-child-beans以及http:// springindepth .COM /电子书/深入-IOC-豆inheritance.html – p91paul 2015-05-13 10:26:15