DefaultListableBeanFactory checks for alias circle on registerAlias (avoiding endless loop; SPR-7274)
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user