Class BeanCreationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.beans.BeansException
org.springframework.beans.FatalBeanException
org.springframework.beans.factory.BeanCreationException
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- BeanCreationNotAllowedException,- BeanCurrentlyInCreationException,- BeanIsAbstractException,- ScopeNotActiveException,- UnsatisfiedDependencyException
Exception thrown when a BeanFactory encounters an error when
 attempting to create a bean from a bean definition.
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new BeanCreationException.BeanCreationException(String beanName, String msg) Create a new BeanCreationException.BeanCreationException(String resourceDescription, String beanName, String msg) Create a new BeanCreationException.BeanCreationException(String resourceDescription, String beanName, String msg, Throwable cause) Create a new BeanCreationException.BeanCreationException(String beanName, String msg, Throwable cause) Create a new BeanCreationException.BeanCreationException(String msg, Throwable cause) Create a new BeanCreationException.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd a related cause to this bean creation exception, not being a direct cause of the failure but having occurred earlier in the creation of the same bean instance.booleanCheck whether this exception contains an exception of the given type: either it is of the given class itself or it contains a nested cause of the given type.Return the name of the bean requested, if any.Return the related causes, if any.Return the description of the resource that the bean definition came from, if any.voidvoidtoString()Methods inherited from class org.springframework.core.NestedRuntimeExceptiongetMostSpecificCause, getRootCauseMethods inherited from class java.lang.ThrowableaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace
- 
Constructor Details- 
BeanCreationExceptionCreate a new BeanCreationException.- Parameters:
- msg- the detail message
 
- 
BeanCreationExceptionCreate a new BeanCreationException.- Parameters:
- msg- the detail message
- cause- the root cause
 
- 
BeanCreationExceptionCreate a new BeanCreationException.- Parameters:
- beanName- the name of the bean requested
- msg- the detail message
 
- 
BeanCreationExceptionCreate a new BeanCreationException.- Parameters:
- beanName- the name of the bean requested
- msg- the detail message
- cause- the root cause
 
- 
BeanCreationExceptionpublic BeanCreationException(@Nullable String resourceDescription, @Nullable String beanName, String msg) Create a new BeanCreationException.- Parameters:
- resourceDescription- description of the resource that the bean definition came from
- beanName- the name of the bean requested
- msg- the detail message
 
- 
BeanCreationExceptionpublic BeanCreationException(@Nullable String resourceDescription, String beanName, String msg, Throwable cause) Create a new BeanCreationException.- Parameters:
- resourceDescription- description of the resource that the bean definition came from
- beanName- the name of the bean requested
- msg- the detail message
- cause- the root cause
 
 
- 
- 
Method Details- 
getResourceDescriptionReturn the description of the resource that the bean definition came from, if any.
- 
getBeanNameReturn the name of the bean requested, if any.
- 
addRelatedCauseAdd a related cause to this bean creation exception, not being a direct cause of the failure but having occurred earlier in the creation of the same bean instance.- Parameters:
- ex- the related cause to add
 
- 
getRelatedCausesReturn the related causes, if any.- Returns:
- the array of related causes, or nullif none
 
- 
toString
- 
printStackTrace- Overrides:
- printStackTracein class- Throwable
 
- 
printStackTrace- Overrides:
- printStackTracein class- Throwable
 
- 
containsDescription copied from class:NestedRuntimeExceptionCheck whether this exception contains an exception of the given type: either it is of the given class itself or it contains a nested cause of the given type.- Overrides:
- containsin class- NestedRuntimeException
- Parameters:
- exClass- the exception type to look for
- Returns:
- whether there is a nested exception of the specified type
 
 
-