org.springframework.beans.factory

Class NoUniqueBeanDefinitionException

  • All Implemented Interfaces:
    java.io.Serializable


    public class NoUniqueBeanDefinitionException
    extends NoSuchBeanDefinitionException
    Exception thrown when a BeanFactory is asked for a bean instance for which multiple matching candidates have been found when only one matching bean was expected.
    Since:
    3.2.1
    Author:
    Juergen Hoeller
    See Also:
    BeanFactory.getBean(Class), Serialized Form
    • Constructor Detail

      • NoUniqueBeanDefinitionException

        public NoUniqueBeanDefinitionException(java.lang.Class<?> type,
                                               int numberOfBeansFound,
                                               java.lang.String message)
        Create a new NoUniqueBeanDefinitionException.
        Parameters:
        type - required type of the non-unique bean
        numberOfBeansFound - the number of matching beans
        message - detailed message describing the problem
      • NoUniqueBeanDefinitionException

        public NoUniqueBeanDefinitionException(java.lang.Class<?> type,
                                               java.util.Collection<java.lang.String> beanNamesFound)
        Create a new NoUniqueBeanDefinitionException.
        Parameters:
        type - required type of the non-unique bean
        beanNamesFound - the names of all matching beans (as a Collection)
      • NoUniqueBeanDefinitionException

        public NoUniqueBeanDefinitionException(java.lang.Class<?> type,
                                               java.lang.String... beanNamesFound)
        Create a new NoUniqueBeanDefinitionException.
        Parameters:
        type - required type of the non-unique bean
        beanNamesFound - the names of all matching beans (as an array)
      • NoUniqueBeanDefinitionException

        public NoUniqueBeanDefinitionException(ResolvableType type,
                                               java.util.Collection<java.lang.String> beanNamesFound)
        Create a new NoUniqueBeanDefinitionException.
        Parameters:
        type - required type of the non-unique bean
        beanNamesFound - the names of all matching beans (as a Collection)
        Since:
        5.1
      • NoUniqueBeanDefinitionException

        public NoUniqueBeanDefinitionException(ResolvableType type,
                                               java.lang.String... beanNamesFound)
        Create a new NoUniqueBeanDefinitionException.
        Parameters:
        type - required type of the non-unique bean
        beanNamesFound - the names of all matching beans (as an array)
        Since:
        5.1