org.springframework.beans.factory

Class BeanCreationException

    • Constructor Summary

      Constructors 
      Constructor and Description
      BeanCreationException(java.lang.String msg)
      Create a new BeanCreationException.
      BeanCreationException(java.lang.String beanName, java.lang.String msg)
      Create a new BeanCreationException.
      BeanCreationException(java.lang.String resourceDescription, java.lang.String beanName, java.lang.String msg)
      Create a new BeanCreationException.
      BeanCreationException(java.lang.String resourceDescription, java.lang.String beanName, java.lang.String msg, java.lang.Throwable cause)
      Create a new BeanCreationException.
      BeanCreationException(java.lang.String beanName, java.lang.String msg, java.lang.Throwable cause)
      Create a new BeanCreationException.
      BeanCreationException(java.lang.String msg, java.lang.Throwable cause)
      Create a new BeanCreationException.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addRelatedCause(java.lang.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(java.lang.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.
      java.lang.String getBeanName()
      Return the name of the bean requested, if any.
      java.lang.Throwable[] getRelatedCauses()
      Return the related causes, if any.
      java.lang.String getResourceDescription()
      Return the description of the resource that the bean definition came from, if any.
      void printStackTrace(java.io.PrintStream ps) 
      void printStackTrace(java.io.PrintWriter pw) 
      java.lang.String toString() 
      • Methods inherited from class java.lang.Throwable

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

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

      • BeanCreationException

        public BeanCreationException(java.lang.String msg)
        Create a new BeanCreationException.
        Parameters:
        msg - the detail message
      • BeanCreationException

        public BeanCreationException(java.lang.String msg,
                                     java.lang.Throwable cause)
        Create a new BeanCreationException.
        Parameters:
        msg - the detail message
        cause - the root cause
      • BeanCreationException

        public BeanCreationException(java.lang.String beanName,
                                     java.lang.String msg)
        Create a new BeanCreationException.
        Parameters:
        beanName - the name of the bean requested
        msg - the detail message
      • BeanCreationException

        public BeanCreationException(java.lang.String beanName,
                                     java.lang.String msg,
                                     java.lang.Throwable cause)
        Create a new BeanCreationException.
        Parameters:
        beanName - the name of the bean requested
        msg - the detail message
        cause - the root cause
      • BeanCreationException

        public BeanCreationException(@Nullable
                                     java.lang.String resourceDescription,
                                     @Nullable
                                     java.lang.String beanName,
                                     java.lang.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
      • BeanCreationException

        public BeanCreationException(@Nullable
                                     java.lang.String resourceDescription,
                                     java.lang.String beanName,
                                     java.lang.String msg,
                                     java.lang.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 Detail

      • getResourceDescription

        @Nullable
        public java.lang.String getResourceDescription()
        Return the description of the resource that the bean definition came from, if any.
      • getBeanName

        @Nullable
        public java.lang.String getBeanName()
        Return the name of the bean requested, if any.
      • addRelatedCause

        public void addRelatedCause(java.lang.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.
        Parameters:
        ex - the related cause to add
      • getRelatedCauses

        @Nullable
        public java.lang.Throwable[] getRelatedCauses()
        Return the related causes, if any.
        Returns:
        the array of related causes, or null if none
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Throwable
      • printStackTrace

        public void printStackTrace(java.io.PrintStream ps)
        Overrides:
        printStackTrace in class java.lang.Throwable
      • printStackTrace

        public void printStackTrace(java.io.PrintWriter pw)
        Overrides:
        printStackTrace in class java.lang.Throwable
      • contains

        public boolean contains(@Nullable
                                java.lang.Class<?> exClass)
        Description copied from class: 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.
        Overrides:
        contains in class NestedRuntimeException
        Parameters:
        exClass - the exception type to look for
        Returns:
        whether there is a nested exception of the specified type