org.springframework.beans.factory

## 类 BeanNotOfRequiredTypeException

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

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

      public class BeanNotOfRequiredTypeException
      extends BeansException

  Thrown when a bean doesn't match the expected type.
  作者:
    Rod Johnson, Juergen Hoeller
  另请参阅:
    序列化表格

- - ### 构造器概要

    构造器
    构造器和说明
    `BeanNotOfRequiredTypeException(String beanName, Class<?> requiredType, Class<?> actualType)` Create a new BeanNotOfRequiredTypeException.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `Class<?>` | `getActualType()` Return the actual type of the instance found.
    `String` | `getBeanName()` Return the name of the instance that was of the wrong type.
    `Class<?>` | `getRequiredType()` Return the expected type for the bean.

    - ### 从类继承的方法 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`

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

    - #### BeanNotOfRequiredTypeException

          public BeanNotOfRequiredTypeException(String beanName,
                                                Class<?> requiredType,
                                                Class<?> actualType)

      Create a new BeanNotOfRequiredTypeException.
      参数:
        `beanName` - the name of the bean requested
        `requiredType` - the required type
        `actualType` - the actual type returned, which did not match the expected type

  - ### 方法详细资料

    - #### getBeanName

          public String getBeanName()

      Return the name of the instance that was of the wrong type.

    - #### getRequiredType

          public Class<?> getRequiredType()

      Return the expected type for the bean.

    - #### getActualType

          public Class<?> getActualType()

      Return the actual type of the instance found.