Class NoSuchBeanDefinitionException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.beans.BeansException
org.springframework.beans.factory.NoSuchBeanDefinitionException
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- NoUniqueBeanDefinitionException
Exception thrown when a 
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.- Author:
- Rod Johnson, Juergen Hoeller, Stephane Nicoll
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionNoSuchBeanDefinitionException(Class<?> type) Create a newNoSuchBeanDefinitionException.NoSuchBeanDefinitionException(Class<?> type, String message) Create a newNoSuchBeanDefinitionException.Create a newNoSuchBeanDefinitionException.NoSuchBeanDefinitionException(String name, String message) Create a newNoSuchBeanDefinitionException.Create a newNoSuchBeanDefinitionException.NoSuchBeanDefinitionException(ResolvableType type, String message) Create a newNoSuchBeanDefinitionException.
- 
Method SummaryModifier and TypeMethodDescriptionReturn the name of the missing bean, if it was a lookup by name that failed.Class<?>Return the required type of the missing bean, if it was a lookup by type that failed.intReturn the number of beans found when only one matching bean was expected.Return the requiredResolvableTypeof the missing bean, if it was a lookup by type that failed.Methods inherited from class org.springframework.core.NestedRuntimeExceptioncontains, getMostSpecificCause, getRootCauseMethods inherited from class java.lang.ThrowableaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
- 
Constructor Details- 
NoSuchBeanDefinitionExceptionCreate a newNoSuchBeanDefinitionException.- Parameters:
- name- the name of the missing bean
 
- 
NoSuchBeanDefinitionExceptionCreate a newNoSuchBeanDefinitionException.- Parameters:
- name- the name of the missing bean
- message- detailed message describing the problem
 
- 
NoSuchBeanDefinitionExceptionCreate a newNoSuchBeanDefinitionException.- Parameters:
- type- required type of the missing bean
 
- 
NoSuchBeanDefinitionExceptionCreate a newNoSuchBeanDefinitionException.- Parameters:
- type- required type of the missing bean
- message- detailed message describing the problem
 
- 
NoSuchBeanDefinitionExceptionCreate a newNoSuchBeanDefinitionException.- Parameters:
- type- full type declaration of the missing bean
- Since:
- 4.3.4
 
- 
NoSuchBeanDefinitionExceptionCreate a newNoSuchBeanDefinitionException.- Parameters:
- type- full type declaration of the missing bean
- message- detailed message describing the problem
- Since:
- 4.3.4
 
 
- 
- 
Method Details- 
getBeanNameReturn the name of the missing bean, if it was a lookup by name that failed.
- 
getBeanTypeReturn the required type of the missing bean, if it was a lookup by type that failed.
- 
getResolvableTypeReturn the requiredResolvableTypeof the missing bean, if it was a lookup by type that failed.- Since:
- 4.3.4
 
- 
getNumberOfBeansFoundpublic int getNumberOfBeansFound()Return the number of beans found when only one matching bean was expected. For a regular NoSuchBeanDefinitionException, this will always be 0.- See Also:
 
 
-