org.springframework.beans

Class BeanInstantiationException

  • All Implemented Interfaces:
    java.io.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 and Description
      BeanInstantiationException(java.lang.Class<?> beanClass, java.lang.String msg)
      Create a new BeanInstantiationException.
      BeanInstantiationException(java.lang.Class<?> beanClass, java.lang.String msg, java.lang.Throwable cause)
      Create a new BeanInstantiationException.
      BeanInstantiationException(java.lang.reflect.Constructor<?> constructor, java.lang.String msg, java.lang.Throwable cause)
      Create a new BeanInstantiationException.
      BeanInstantiationException(java.lang.reflect.Method constructingMethod, java.lang.String msg, java.lang.Throwable cause)
      Create a new BeanInstantiationException.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Class<?> getBeanClass()
      Return the offending bean class (never null).
      java.lang.reflect.Method getConstructingMethod()
      Return the delegate for bean construction purposes, if known.
      java.lang.reflect.Constructor<?> getConstructor()
      Return the offending constructor, if known.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BeanInstantiationException

        public BeanInstantiationException(java.lang.Class<?> beanClass,
                                          java.lang.String msg)
        Create a new BeanInstantiationException.
        Parameters:
        beanClass - the offending bean class
        msg - the detail message
      • BeanInstantiationException

        public BeanInstantiationException(java.lang.Class<?> beanClass,
                                          java.lang.String msg,
                                          @Nullable
                                          java.lang.Throwable cause)
        Create a new BeanInstantiationException.
        Parameters:
        beanClass - the offending bean class
        msg - the detail message
        cause - the root cause
      • BeanInstantiationException

        public BeanInstantiationException(java.lang.reflect.Constructor<?> constructor,
                                          java.lang.String msg,
                                          @Nullable
                                          java.lang.Throwable cause)
        Create a new BeanInstantiationException.
        Parameters:
        constructor - the offending constructor
        msg - the detail message
        cause - the root cause
        Since:
        4.3
      • BeanInstantiationException

        public BeanInstantiationException(java.lang.reflect.Method constructingMethod,
                                          java.lang.String msg,
                                          @Nullable
                                          java.lang.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 message
        cause - the root cause
        Since:
        4.3
    • Method Detail

      • getBeanClass

        public java.lang.Class<?> getBeanClass()
        Return the offending bean class (never null).
        Returns:
        the class that was to be instantiated
      • getConstructor

        @Nullable
        public java.lang.reflect.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

        @Nullable
        public java.lang.reflect.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