QualifierAnnotationAutowireCandidateResolver matches regular bean name for FactoryBean dependency type as well

This commit is contained in:
Juergen Hoeller
2013-10-31 13:40:05 +01:00
committed by unknown
parent ec24299092
commit 6e418fe43d
2 changed files with 15 additions and 2 deletions

View File

@@ -17,6 +17,7 @@
package org.springframework.beans.factory.config;
import org.springframework.beans.BeanMetadataElement;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
@@ -118,8 +119,9 @@ public class BeanDefinitionHolder implements BeanMetadataElement {
* or the aliases stored in this bean definition.
*/
public boolean matchesName(String candidateName) {
return (candidateName != null &&
(candidateName.equals(this.beanName) || ObjectUtils.containsElement(this.aliases, candidateName)));
return (candidateName != null && (candidateName.equals(this.beanName) ||
candidateName.equals(BeanFactoryUtils.transformedBeanName(this.beanName)) ||
ObjectUtils.containsElement(this.aliases, candidateName)));
}