org.springframework.beans.factory.annotation
Class BeanFactoryAnnotationUtils

java.lang.Object
  extended by org.springframework.beans.factory.annotation.BeanFactoryAnnotationUtils

public class BeanFactoryAnnotationUtils
extends Object

Convenience methods performing bean lookups related to annotations, for example Spring's @Qualifier annotation.

Since:
3.1.2
Author:
Chris Beams
See Also:
BeanFactoryUtils

Constructor Summary
BeanFactoryAnnotationUtils()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanFactoryAnnotationUtils

public BeanFactoryAnnotationUtils()
Method Detail

qualifiedBeanOfType

public 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. via <qualifier> or @Qualifier) matching the given qualifier, or having a bean name matching the given qualifier.

Parameters:
beanFactory - the BeanFactory to get the target bean from
beanType - the type of bean to retrieve
qualifier - the qualifier for selecting between multiple bean matches
Returns:
the matching bean of type T (never null)
Throws:
NoSuchBeanDefinitionException - if no matching bean of type T found