spring-framework / org.springframework.beans.factory / NoUniqueBeanDefinitionException

NoUniqueBeanDefinitionException

open class NoUniqueBeanDefinitionException : 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.

Author
Juergen Hoeller

Since
3.2.1

See Also
BeanFactory#getBean(Class)

Constructors

<init>

NoUniqueBeanDefinitionException(type: Class<*>, numberOfBeansFound: Int, message: String)
NoUniqueBeanDefinitionException(type: Class<*>, beanNamesFound: MutableCollection<String>)
NoUniqueBeanDefinitionException(type: Class<*>, vararg beanNamesFound: String)

Create a new NoUniqueBeanDefinitionException.

Functions

getBeanNamesFound

open fun getBeanNamesFound(): MutableCollection<String>

Return the names of all beans found when only one matching bean was expected. Note that this may be null if not specified at construction time.

getNumberOfBeansFound

open fun getNumberOfBeansFound(): Int

Return the number of beans found when only one matching bean was expected. For a NoUniqueBeanDefinitionException, this will usually be higher than 1.