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 Form| Constructor and Description |
|---|
NoUniqueBeanDefinitionException(Class<?> type,
Collection<String> beanNamesFound)
Create a new
NoUniqueBeanDefinitionException. |
NoUniqueBeanDefinitionException(Class<?> type,
int numberOfBeansFound,
String message)
Create a new
NoUniqueBeanDefinitionException. |
NoUniqueBeanDefinitionException(Class<?> type,
String... beanNamesFound)
Create a new
NoUniqueBeanDefinitionException. |
| Modifier and Type | Method and Description |
|---|---|
Collection<String> |
getBeanNamesFound()
Return the names of all beans found when only one matching bean was expected.
|
int |
getNumberOfBeansFound()
Return the number of beans found when only one matching bean was expected.
|
getBeanName, getBeanType, getResolvableTypeequals, hashCodecontains, getMessage, getMostSpecificCause, getRootCauseaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic NoUniqueBeanDefinitionException(Class<?> type, int numberOfBeansFound, String message)
NoUniqueBeanDefinitionException.type - required type of the non-unique beannumberOfBeansFound - the number of matching beansmessage - detailed message describing the problempublic NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNamesFound)
NoUniqueBeanDefinitionException.type - required type of the non-unique beanbeanNamesFound - the names of all matching beans (as a Collection)public int getNumberOfBeansFound()
getNumberOfBeansFound in class NoSuchBeanDefinitionExceptionNoSuchBeanDefinitionException.getBeanType()public Collection<String> getBeanNamesFound()
null if not specified at construction time.NoSuchBeanDefinitionException.getBeanType()