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

This commit is contained in:
Juergen Hoeller
2010-06-10 21:45:47 +00:00
parent 433b4eff8f
commit 11330baf77
2 changed files with 32 additions and 0 deletions

View File

@@ -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();