public abstract class BeanFactoryAnnotationUtils
extends java.lang.Object
@Qualifier
annotation.BeanFactoryUtils
Constructor and Description |
---|
BeanFactoryAnnotationUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
qualifiedBeanOfType(BeanFactory beanFactory,
java.lang.Class<T> beanType,
java.lang.String qualifier)
Obtain a bean of type
T from the given BeanFactory declaring a
qualifier (e.g. |
public static <T> T qualifiedBeanOfType(BeanFactory beanFactory, java.lang.Class<T> beanType, java.lang.String qualifier) throws BeansException
T
from the given BeanFactory
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 matchesT
(never null
)NoUniqueBeanDefinitionException
- if multiple matching beans of type T
foundNoSuchBeanDefinitionException
- if no matching bean of type T
foundBeansException
- if the bean could not be createdBeanFactory.getBean(Class)