org.springframework.beans.factory

## 类 NoUniqueBeanDefinitionException

- 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
            - - org.springframework.beans.factory.NoUniqueBeanDefinitionException

- 所有已实现的接口:
    Serializable

      public class NoUniqueBeanDefinitionException
      extends NoSuchBeanDefinitionException

  Exception thrown when a `BeanFactory` is asked for a bean instance for which multiple matching candidates have been found when only one matching bean was expected.
  从以下版本开始:
    3.2.1
  作者:
    Juergen Hoeller
  另请参阅:
    `BeanFactory.getBean(Class)`, 序列化表格

- - ### 构造器概要

    构造器
    构造器和说明
    `NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNamesFound)` Create a new `NoUniqueBeanDefinitionException`.
    `NoUniqueBeanDefinitionException(Class<?> type, int numberOfBeansFound, String message)` Create a new `NoUniqueBeanDefinitionException`.
    `NoUniqueBeanDefinitionException(Class<?> type, String... beanNamesFound)` Create a new `NoUniqueBeanDefinitionException`.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `Collection<String>` | `getBeanNamesFound()` Return the names of all beans found when only one matching bean was expected.
    `int` | `getNumberOfBeansFound()` Return the number of beans found when only one matching bean was expected.

    - ### 从类继承的方法 org.springframework.beans.factory.NoSuchBeanDefinitionException

      `getBeanName, getBeanType, getResolvableType`

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

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

    - #### NoUniqueBeanDefinitionException

          public NoUniqueBeanDefinitionException(Class<?> type,
                                                 int numberOfBeansFound,
                                                 String message)

      Create a new `NoUniqueBeanDefinitionException`.
      参数:
        `type` - required type of the non-unique bean
        `numberOfBeansFound` - the number of matching beans
        `message` - detailed message describing the problem

    - #### NoUniqueBeanDefinitionException

          public NoUniqueBeanDefinitionException(Class<?> type,
                                                 Collection<String> beanNamesFound)

      Create a new `NoUniqueBeanDefinitionException`.
      参数:
        `type` - required type of the non-unique bean
        `beanNamesFound` - the names of all matching beans (as a Collection)

    - #### NoUniqueBeanDefinitionException

          public NoUniqueBeanDefinitionException(Class<?> type,
                                                 String... beanNamesFound)

      Create a new `NoUniqueBeanDefinitionException`.
      参数:
        `type` - required type of the non-unique bean
        `beanNamesFound` - the names of all matching beans (as an array)

  - ### 方法详细资料

    - #### getNumberOfBeansFound

          public int getNumberOfBeansFound()

      Return the number of beans found when only one matching bean was expected. For a NoUniqueBeanDefinitionException, this will usually be higher than 1.
      覆盖:
        `getNumberOfBeansFound` 在类中 `NoSuchBeanDefinitionException`
      另请参阅:
        `NoSuchBeanDefinitionException.getBeanType()`

    - #### getBeanNamesFound

          @Nullable
          public Collection<String> getBeanNamesFound()

      Return the names of all beans found when only one matching bean was expected. Note that this may be `null` if not specified at construction time.
      从以下版本开始:
        4.3
      另请参阅:
        `NoSuchBeanDefinitionException.getBeanType()`