child bean definition's scope attribute can be inherited from parent bean definition now (SPR-3542)

This commit is contained in:
Juergen Hoeller
2009-11-12 00:09:05 +00:00
parent 4a25e2dde0
commit d0b6891275
6 changed files with 17 additions and 12 deletions

View File

@@ -3,7 +3,7 @@
<beans>
<bean id="inheritedTestBean" class="org.springframework.beans.TestBean" abstract="true">
<bean id="inheritedTestBean" class="org.springframework.beans.TestBean" abstract="true" scope="prototype">
<property name="name"><value>parent</value></property>
<property name="age"><value>1</value></property>
</bean>

View File

@@ -286,7 +286,7 @@ public final class XmlBeanFactoryTests {
}
}
public @Test void testSingletonInheritanceFromParentFactorySingleton() throws Exception {
public @Test void testInheritanceFromParentFactoryPrototype() throws Exception {
XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
assertEquals(TestBean.class, child.getType("inheritsFromParentFactory"));
@@ -296,7 +296,7 @@ public final class XmlBeanFactoryTests {
// Age property is inherited from bean in parent factory
assertTrue(inherits.getAge() == 1);
TestBean inherits2 = (TestBean) child.getBean("inheritsFromParentFactory");
assertTrue(inherits2 == inherits);
assertFalse(inherits2 == inherits);
}
public @Test void testInheritanceWithDifferentClass() throws Exception {
@@ -420,7 +420,7 @@ public final class XmlBeanFactoryTests {
// Age property is inherited from bean in parent factory
assertTrue(inherits.getAge() == 1);
TestBean inherits2 = (TestBean) child.getBean("inheritedTestBean");
assertTrue(inherits2 == inherits);
assertTrue(inherits2 != inherits);
}
/**