org.springframework.beans.factory

## 类 NoSuchBeanDefinitionException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - org.springframework.core.NestedRuntimeException
        - - org.springframework.beans.BeansException
          - - org.springframework.beans.factory.NoSuchBeanDefinitionException

- 所有已实现的接口:
    Serializable
  直接已知子类:
    NoUniqueBeanDefinitionException

      public class NoSuchBeanDefinitionException
      extends BeansException

  Exception thrown when a `BeanFactory` is asked for a bean instance for which it cannot find a definition. This may point to a non-existing bean, a non-unique bean, or a manually registered singleton instance without an associated bean definition.
  作者:
    Rod Johnson, Juergen Hoeller, Stephane Nicoll
  另请参阅:
    `BeanFactory.getBean(String)`, `BeanFactory.getBean(Class)`, `NoUniqueBeanDefinitionException`, 序列化表格

- - ### 构造器概要

    构造器
    构造器和说明
    `NoSuchBeanDefinitionException(Class<?> type)` Create a new `NoSuchBeanDefinitionException`.
    `NoSuchBeanDefinitionException(Class<?> type, String message)` Create a new `NoSuchBeanDefinitionException`.
    `NoSuchBeanDefinitionException(org.springframework.core.ResolvableType type)` Create a new `NoSuchBeanDefinitionException`.
    `NoSuchBeanDefinitionException(org.springframework.core.ResolvableType type, String message)` Create a new `NoSuchBeanDefinitionException`.
    `NoSuchBeanDefinitionException(String name)` Create a new `NoSuchBeanDefinitionException`.
    `NoSuchBeanDefinitionException(String name, String message)` Create a new `NoSuchBeanDefinitionException`.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `String` | `getBeanName()` Return the name of the missing bean, if it was a lookup by name that failed.
    `Class<?>` | `getBeanType()` Return the required type of the missing bean, if it was a lookup by type that failed.
    `int` | `getNumberOfBeansFound()` Return the number of beans found when only one matching bean was expected.
    `org.springframework.core.ResolvableType` | `getResolvableType()` Return the required `ResolvableType` of the missing bean, if it was a lookup by type that failed.

    - ### 从类继承的方法 org.springframework.core.NestedRuntimeException

      `contains, getMessage, getMostSpecificCause, getRootCause`

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

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

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

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

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

    - #### NoSuchBeanDefinitionException

          public NoSuchBeanDefinitionException(String name)

      Create a new `NoSuchBeanDefinitionException`.
      参数:
        `name` - the name of the missing bean

    - #### NoSuchBeanDefinitionException

          public NoSuchBeanDefinitionException(String name,
                                               String message)

      Create a new `NoSuchBeanDefinitionException`.
      参数:
        `name` - the name of the missing bean
        `message` - detailed message describing the problem

    - #### NoSuchBeanDefinitionException

          public NoSuchBeanDefinitionException(Class<?> type)

      Create a new `NoSuchBeanDefinitionException`.
      参数:
        `type` - required type of the missing bean

    - #### NoSuchBeanDefinitionException

          public NoSuchBeanDefinitionException(Class<?> type,
                                               String message)

      Create a new `NoSuchBeanDefinitionException`.
      参数:
        `type` - required type of the missing bean
        `message` - detailed message describing the problem

    - #### NoSuchBeanDefinitionException

          public NoSuchBeanDefinitionException(org.springframework.core.ResolvableType type)

      Create a new `NoSuchBeanDefinitionException`.
      参数:
        `type` - full type declaration of the missing bean
      从以下版本开始:
        4.3.4

    - #### NoSuchBeanDefinitionException

          public NoSuchBeanDefinitionException(org.springframework.core.ResolvableType type,
                                               String message)

      Create a new `NoSuchBeanDefinitionException`.
      参数:
        `type` - full type declaration of the missing bean
        `message` - detailed message describing the problem
      从以下版本开始:
        4.3.4

  - ### 方法详细资料

    - #### getBeanName

          @Nullable
          public String getBeanName()

      Return the name of the missing bean, if it was a lookup by name that failed.

    - #### getBeanType

          @Nullable
          public Class<?> getBeanType()

      Return the required type of the missing bean, if it was a lookup by type that failed.

    - #### getResolvableType

          @Nullable
          public org.springframework.core.ResolvableType getResolvableType()

      Return the required `ResolvableType` of the missing bean, if it was a lookup by type that failed.
      从以下版本开始:
        4.3.4

    - #### getNumberOfBeansFound

          public int getNumberOfBeansFound()

      Return the number of beans found when only one matching bean was expected. For a regular NoSuchBeanDefinitionException, this will always be 0.
      另请参阅:
        `NoUniqueBeanDefinitionException`