public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionException
BeanFactory
is asked for a bean instance for which
multiple matching candidates have been found when only one matching bean was expected.BeanFactory.getBean(Class)
,
Serialized FormConstructor and Description |
---|
NoUniqueBeanDefinitionException(java.lang.Class<?> type,
java.util.Collection<java.lang.String> beanNamesFound)
Create a new
NoUniqueBeanDefinitionException . |
NoUniqueBeanDefinitionException(java.lang.Class<?> type,
int numberOfBeansFound,
java.lang.String message)
Create a new
NoUniqueBeanDefinitionException . |
NoUniqueBeanDefinitionException(java.lang.Class<?> type,
java.lang.String... beanNamesFound)
Create a new
NoUniqueBeanDefinitionException . |
Modifier and Type | Method and Description |
---|---|
int |
getNumberOfBeansFound()
Return the number of beans found when only one matching bean was expected.
|
getBeanName, getBeanType
equals, hashCode
contains, getMessage, getMostSpecificCause, getRootCause
public NoUniqueBeanDefinitionException(java.lang.Class<?> type, int numberOfBeansFound, java.lang.String message)
NoUniqueBeanDefinitionException
.type
- required type of the non-unique beannumberOfBeansFound
- the number of matching beansmessage
- detailed message describing the problempublic NoUniqueBeanDefinitionException(java.lang.Class<?> type, java.util.Collection<java.lang.String> beanNamesFound)
NoUniqueBeanDefinitionException
.type
- required type of the non-unique beanbeanNamesFound
- the names of all matching beans (as a Collection)public NoUniqueBeanDefinitionException(java.lang.Class<?> type, java.lang.String... beanNamesFound)
NoUniqueBeanDefinitionException
.type
- required type of the non-unique beanbeanNamesFound
- the names of all matching beans (as an array)public int getNumberOfBeansFound()
getNumberOfBeansFound
in class NoSuchBeanDefinitionException
NoSuchBeanDefinitionException.getBeanType()