org.springframework.beans.factory

## 类 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)`
    `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`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 构造器详细资料

    - #### 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 message
        `cause` - the root cause

    - #### BeanCreationException

          public BeanCreationException(String beanName,
                                       String msg)

      Create a new BeanCreationException.
      参数:
        `beanName` - the name of the bean requested
        `msg` - the detail message

    - #### BeanCreationException

          public BeanCreationException(String beanName,
                                       String msg,
                                       Throwable cause)

      Create a new BeanCreationException.
      参数:
        `beanName` - the name of the bean requested
        `msg` - the detail message
        `cause` - 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 from
        `beanName` - the name of the bean requested
        `msg` - 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 from
        `beanName` - the name of the bean requested
        `msg` - the detail message
        `cause` - 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

    - #### toString

          public String toString()

      覆盖:
        `toString` 在类中 `Throwable`

    - #### printStackTrace

          public void printStackTrace(PrintStream ps)

      覆盖:
        `printStackTrace` 在类中 `Throwable`

    - #### printStackTrace

          public void printStackTrace(PrintWriter pw)

      覆盖:
        `printStackTrace` 在类中 `Throwable`

    - #### contains

          public boolean contains(@Nullable
                                  Class<?> exClass)

      覆盖:
        `contains` 在类中 `org.springframework.core.NestedRuntimeException`