DefaultListableBeanFactory checks for alias circle on registerAlias (avoiding endless loop; SPR-7274)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3409 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2010-06-10 21:45:47 +00:00
parent ec93f21809
commit f15338b7dd
2 changed files with 32 additions and 0 deletions
@@ -723,6 +723,20 @@ public class DefaultListableBeanFactoryTests {
assertTrue("Test bean age is 48", tb.getAge() == 48);
}
@Test
public void testAliasCircle() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
lbf.registerAlias("test", "test2");
lbf.registerAlias("test2", "test3");
try {
lbf.registerAlias("test3", "test");
fail("Should have thrown IllegalStateException");
}
catch (IllegalStateException ex) {
// expected
}
}
@Test
public void testBeanDefinitionOverriding() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();