public class NoSuchBeanDefinitionException extends BeansException
BeanFactory
is asked for a bean instance for which it
cannot find a definition. This may point to a non-existing bean, a non-unique bean,
or a manually registered singleton instance without an associated bean definition.BeanFactory.getBean(String)
,
BeanFactory.getBean(Class)
,
NoUniqueBeanDefinitionException
,
Serialized FormConstructor and Description |
---|
NoSuchBeanDefinitionException(Class<?> type)
Create a new
NoSuchBeanDefinitionException . |
NoSuchBeanDefinitionException(Class<?> type,
String message)
Create a new
NoSuchBeanDefinitionException . |
NoSuchBeanDefinitionException(Class<?> type,
String dependencyDescription,
String message)
Deprecated.
as of 4.3.4, in favor of
NoSuchBeanDefinitionException(ResolvableType, String) |
NoSuchBeanDefinitionException(ResolvableType type)
Create a new
NoSuchBeanDefinitionException . |
NoSuchBeanDefinitionException(ResolvableType type,
String message)
Create a new
NoSuchBeanDefinitionException . |
NoSuchBeanDefinitionException(String name)
Create a new
NoSuchBeanDefinitionException . |
NoSuchBeanDefinitionException(String name,
String message)
Create a new
NoSuchBeanDefinitionException . |
Modifier and Type | Method and Description |
---|---|
String |
getBeanName()
Return the name of the missing bean, if it was a lookup by name that failed.
|
Class<?> |
getBeanType()
Return the required type of the missing bean, if it was a lookup by type
that failed.
|
int |
getNumberOfBeansFound()
Return the number of beans found when only one matching bean was expected.
|
ResolvableType |
getResolvableType()
Return the required
ResolvableType of the missing bean, if it was a lookup
by type that failed. |
equals, hashCode
contains, getMessage, getMostSpecificCause, getRootCause
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public NoSuchBeanDefinitionException(String name)
NoSuchBeanDefinitionException
.name
- the name of the missing beanpublic NoSuchBeanDefinitionException(String name, String message)
NoSuchBeanDefinitionException
.name
- the name of the missing beanmessage
- detailed message describing the problempublic NoSuchBeanDefinitionException(Class<?> type)
NoSuchBeanDefinitionException
.type
- required type of the missing beanpublic NoSuchBeanDefinitionException(Class<?> type, String message)
NoSuchBeanDefinitionException
.type
- required type of the missing beanmessage
- detailed message describing the problempublic NoSuchBeanDefinitionException(ResolvableType type)
NoSuchBeanDefinitionException
.type
- full type declaration of the missing beanpublic NoSuchBeanDefinitionException(ResolvableType type, String message)
NoSuchBeanDefinitionException
.type
- full type declaration of the missing beanmessage
- detailed message describing the problem@Deprecated public NoSuchBeanDefinitionException(Class<?> type, String dependencyDescription, String message)
NoSuchBeanDefinitionException(ResolvableType, String)
NoSuchBeanDefinitionException
.type
- required type of the missing beandependencyDescription
- a description of the originating dependencymessage
- detailed message describing the problempublic String getBeanName()
public Class<?> getBeanType()
public ResolvableType getResolvableType()
ResolvableType
of the missing bean, if it was a lookup
by type that failed.public int getNumberOfBeansFound()
NoUniqueBeanDefinitionException