diff --git a/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests-context.xml b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests-context.xml
index 53fc7af94b278ace11420bc2247a96a90a119267..0dea4d5c342894ff4e06427c08820ebb1b51eca6 100644
--- a/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests-context.xml
+++ b/org.springframework.context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests-context.xml
@@ -11,7 +11,9 @@
-
+
+
+
diff --git a/org.springframework.core/src/main/java/org/springframework/core/SimpleAliasRegistry.java b/org.springframework.core/src/main/java/org/springframework/core/SimpleAliasRegistry.java
index 5f3e974ae3ed2d6ed1ab3210948e292455a51039..31583f9589ab4db37601b7b5b7df5d84b738adf5 100644
--- a/org.springframework.core/src/main/java/org/springframework/core/SimpleAliasRegistry.java
+++ b/org.springframework.core/src/main/java/org/springframework/core/SimpleAliasRegistry.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,16 +79,27 @@ public class SimpleAliasRegistry implements AliasRegistry {
}
public String[] getAliases(String name) {
- List aliases = new ArrayList();
+ List result = new ArrayList();
synchronized (this.aliasMap) {
- for (Map.Entry entry : this.aliasMap.entrySet()) {
- String registeredName = entry.getValue();
- if (registeredName.equals(name)) {
- aliases.add(entry.getKey());
- }
+ retrieveAliases(name, result);
+ }
+ return StringUtils.toStringArray(result);
+ }
+
+ /**
+ * Transitively retrieve all aliases for the given name.
+ * @param name the target name to find aliases for
+ * @param result the resulting aliases list
+ */
+ private void retrieveAliases(String name, List result) {
+ for (Map.Entry entry : this.aliasMap.entrySet()) {
+ String registeredName = entry.getValue();
+ if (registeredName.equals(name)) {
+ String alias = entry.getKey();
+ result.add(alias);
+ retrieveAliases(alias, result);
}
}
- return StringUtils.toStringArray(aliases);
}
/**