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 . |
NoUniqueBeanDefinitionException(ResolvableType type,
java.util.Collection<java.lang.String> beanNamesFound)
Create a new
NoUniqueBeanDefinitionException . |
NoUniqueBeanDefinitionException(ResolvableType type,
java.lang.String... beanNamesFound)
Create a new
NoUniqueBeanDefinitionException . |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<java.lang.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, getResolvableType
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 NoUniqueBeanDefinitionException(ResolvableType 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(ResolvableType 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()
@Nullable public java.util.Collection<java.lang.String> getBeanNamesFound()
null
if not specified at construction time.NoSuchBeanDefinitionException.getBeanType()