SimpleAliasRegistry detects circles between non-canonical aliases as well (through hasAlias)

Additionally, as an optimization, we skip the re-registration step for existing aliases now.

Issue: SPR-13390
This commit is contained in:
Juergen Hoeller
2015-08-25 17:06:23 +02:00
parent 190eb6ace1
commit b198cad58e
3 changed files with 61 additions and 23 deletions

View File

@@ -788,6 +788,15 @@ public class DefaultListableBeanFactoryTests {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
lbf.registerAlias("test", "test2");
lbf.registerAlias("test2", "test3");
try {
lbf.registerAlias("test3", "test2");
fail("Should have thrown IllegalStateException");
}
catch (IllegalStateException ex) {
// expected
}
try {
lbf.registerAlias("test3", "test");
fail("Should have thrown IllegalStateException");
@@ -795,6 +804,8 @@ public class DefaultListableBeanFactoryTests {
catch (IllegalStateException ex) {
// expected
}
lbf.registerAlias("test", "test3");
}
@Test