类 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
- 所有已实现的接口:
Serializable
- 直接已知子类:
BeanCreationNotAllowedException
,BeanCurrentlyInCreationException
,BeanIsAbstractException
,UnsatisfiedDependencyException
public class BeanCreationException extends FatalBeanException
Exception thrown when a BeanFactory encounters an error when attempting to create a bean from a bean definition.- 作者:
- Juergen Hoeller
- 另请参阅:
- 序列化表格
构造器概要
构造器 构造器 说明 BeanCreationException(String msg)
Create 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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
addRelatedCause(Throwable ex)
Add 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.boolean
contains(Class<?> exClass)
Check 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.String
getBeanName()
Return the name of the bean requested, if any.Throwable[]
getRelatedCauses()
Return the related causes, if any.String
getResourceDescription()
Return the description of the resource that the bean definition came from, if any.void
printStackTrace(PrintStream ps)
void
printStackTrace(PrintWriter pw)
String
toString()
从类继承的方法 org.springframework.core.NestedRuntimeException
getMessage, getMostSpecificCause, getRootCause
从类继承的方法 java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace
构造器详细资料
BeanCreationException
public BeanCreationException(String msg)
Create a new BeanCreationException.- 参数:
msg
- the detail message
BeanCreationException
public BeanCreationException(String msg, Throwable cause)
Create a new BeanCreationException.- 参数:
msg
- the detail messagecause
- the root cause
BeanCreationException
public BeanCreationException(String beanName, String msg)
Create a new BeanCreationException.- 参数:
beanName
- the name of the bean requestedmsg
- the detail message
BeanCreationException
public BeanCreationException(String beanName, String msg, Throwable cause)
Create a new BeanCreationException.- 参数:
beanName
- the name of the bean requestedmsg
- the detail messagecause
- the root cause
BeanCreationException
public BeanCreationException(@Nullable String resourceDescription, @Nullable String beanName, String msg)
Create a new BeanCreationException.- 参数:
resourceDescription
- description of the resource that the bean definition came frombeanName
- the name of the bean requestedmsg
- the detail message
BeanCreationException
public BeanCreationException(@Nullable String resourceDescription, String beanName, String msg, Throwable cause)
Create a new BeanCreationException.- 参数:
resourceDescription
- description of the resource that the bean definition came frombeanName
- the name of the bean requestedmsg
- the detail messagecause
- the root cause
方法详细资料
getResourceDescription
@Nullable public String getResourceDescription()
Return the description of the resource that the bean definition came from, if any.
getBeanName
@Nullable public String getBeanName()
Return the name of the bean requested, if any.
addRelatedCause
public void addRelatedCause(Throwable ex)
Add 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.- 参数:
ex
- the related cause to add
getRelatedCauses
@Nullable public Throwable[] getRelatedCauses()
Return the related causes, if any.- 返回:
- the array of related causes, or
null
if none
printStackTrace
public void printStackTrace(PrintStream ps)
- 覆盖:
printStackTrace
在类中Throwable
printStackTrace
public void printStackTrace(PrintWriter pw)
- 覆盖:
printStackTrace
在类中Throwable
contains
public boolean contains(@Nullable Class<?> exClass)
从类复制的说明:NestedRuntimeException
Check 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.- 覆盖:
contains
在类中NestedRuntimeException
- 参数:
exClass
- the exception type to look for- 返回:
- whether there is a nested exception of the specified type