类 BeanFactoryAnnotationUtils
- java.lang.Object
- org.springframework.beans.factory.annotation.BeanFactoryAnnotationUtils
public abstract class BeanFactoryAnnotationUtils extends Object
Convenience methods performing bean lookups related to annotations, for example Spring's@Qualifier
annotation.- 从以下版本开始:
- 3.1.2
- 作者:
- Juergen Hoeller, Chris Beams
- 另请参阅:
BeanFactoryUtils
构造器概要
构造器 构造器 说明 BeanFactoryAnnotationUtils()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static <T> T
qualifiedBeanOfType(BeanFactory beanFactory, Class<T> beanType, String qualifier)
Obtain a bean of typeT
from the givenBeanFactory
declaring a qualifier (e.g. via<qualifier>
or@Qualifier
) matching the given qualifier, or having a bean name matching the given qualifier.
构造器详细资料
BeanFactoryAnnotationUtils
public BeanFactoryAnnotationUtils()
方法详细资料
qualifiedBeanOfType
public static <T> T qualifiedBeanOfType(BeanFactory beanFactory, Class<T> beanType, String qualifier) throws BeansException
Obtain a bean of typeT
from the givenBeanFactory
declaring a qualifier (e.g. via<qualifier>
or@Qualifier
) matching the given qualifier, or having a bean name matching the given qualifier.- 参数:
beanFactory
- the BeanFactory to get the target bean frombeanType
- the type of bean to retrievequalifier
- the qualifier for selecting between multiple bean matches- 返回:
- the matching bean of type
T
(nevernull
) - 抛出:
NoUniqueBeanDefinitionException
- if multiple matching beans of typeT
foundNoSuchBeanDefinitionException
- if no matching bean of typeT
foundBeansException
- if the bean could not be created- 另请参阅:
BeanFactory.getBean(Class)