Package org.springframework.beans
Class BeanInstantiationException
- 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.BeanInstantiationException
- All Implemented Interfaces:
Serializable
public class BeanInstantiationException extends FatalBeanException
Exception thrown when instantiation of a bean failed. Carries the offending bean class.- Since:
- 1.2.8
- Author:
- Juergen Hoeller
- See Also:
- Serialized Form
Constructor Summary
Constructors Constructor Description BeanInstantiationException(Class<?> beanClass, String msg)
Create a new BeanInstantiationException.BeanInstantiationException(Class<?> beanClass, String msg, Throwable cause)
Create a new BeanInstantiationException.BeanInstantiationException(Constructor<?> constructor, String msg, Throwable cause)
Create a new BeanInstantiationException.BeanInstantiationException(Method constructingMethod, String msg, Throwable cause)
Create a new BeanInstantiationException.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>
getBeanClass()
Return the offending bean class (nevernull
).Method
getConstructingMethod()
Return the delegate for bean construction purposes, if known.Constructor<?>
getConstructor()
Return the offending constructor, if known.Methods inherited from class org.springframework.beans.BeansException
equals, hashCode
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Constructor Detail
BeanInstantiationException
public BeanInstantiationException(Class<?> beanClass, String msg)
Create a new BeanInstantiationException.- Parameters:
beanClass
- the offending bean classmsg
- the detail message
BeanInstantiationException
public BeanInstantiationException(Class<?> beanClass, String msg, Throwable cause)
Create a new BeanInstantiationException.- Parameters:
beanClass
- the offending bean classmsg
- the detail messagecause
- the root cause
BeanInstantiationException
public BeanInstantiationException(Constructor<?> constructor, String msg, Throwable cause)
Create a new BeanInstantiationException.- Parameters:
constructor
- the offending constructormsg
- the detail messagecause
- the root cause- Since:
- 4.3
BeanInstantiationException
public BeanInstantiationException(Method constructingMethod, String msg, Throwable cause)
Create a new BeanInstantiationException.- Parameters:
constructingMethod
- the delegate for bean construction purposes (typically, but not necessarily, a static factory method)msg
- the detail messagecause
- the root cause- Since:
- 4.3
Method Detail
getBeanClass
public Class<?> getBeanClass()
Return the offending bean class (nevernull
).- Returns:
- the class that was to be instantiated
getConstructor
public Constructor<?> getConstructor()
Return the offending constructor, if known.- Returns:
- the constructor in use, or
null
in case of a factory method or in case of default instantiation - Since:
- 4.3
getConstructingMethod
public Method getConstructingMethod()
Return the delegate for bean construction purposes, if known.- Returns:
- the method in use (typically a static factory method), or
null
in case of constructor-based instantiation - Since:
- 4.3