public abstract class BeanFactoryAnnotationUtils extends Object
@Qualifier
annotation.BeanFactoryUtils
Constructor and Description |
---|
BeanFactoryAnnotationUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
qualifiedBeanOfType(BeanFactory beanFactory,
Class<T> beanType,
String qualifier)
Obtain a bean of type
T from the given BeanFactory declaring a
qualifier (e.g. |
public static <T> T qualifiedBeanOfType(BeanFactory beanFactory, Class<T> beanType, 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)