introduced "matchesName" method on BeanDefinitionHolder
This commit is contained in:
parent
565c1c1320
commit
fbfbb88032
|
|
@ -209,8 +209,7 @@ public class QualifierAnnotationAutowireCandidateResolver implements AutowireCan
|
||||||
actualValue = bd.getAttribute(attributeName);
|
actualValue = bd.getAttribute(attributeName);
|
||||||
}
|
}
|
||||||
if (actualValue == null && attributeName.equals(AutowireCandidateQualifier.VALUE_KEY) &&
|
if (actualValue == null && attributeName.equals(AutowireCandidateQualifier.VALUE_KEY) &&
|
||||||
(expectedValue.equals(bdHolder.getBeanName()) ||
|
expectedValue instanceof String && bdHolder.matchesName((String) expectedValue)) {
|
||||||
ObjectUtils.containsElement(bdHolder.getAliases(), expectedValue))) {
|
|
||||||
// fall back on bean name (or alias) match
|
// fall back on bean name (or alias) match
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -112,6 +112,15 @@ public class BeanDefinitionHolder implements BeanMetadataElement {
|
||||||
return this.beanDefinition.getSource();
|
return this.beanDefinition.getSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the given candidate name matches the bean name
|
||||||
|
* 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 a friendly, short description for the bean, stating name and aliases.
|
* Return a friendly, short description for the bean, stating name and aliases.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue