org.springframework.beans.factory.support

## 接口 BeanDefinitionReader

- 所有已知实现类:
    AbstractBeanDefinitionReader, GroovyBeanDefinitionReader, PropertiesBeanDefinitionReader, XmlBeanDefinitionReader

      public interface BeanDefinitionReader

  Simple interface for bean definition readers. Specifies load methods with Resource and String location parameters.

  Concrete bean definition readers can of course add additional load and register methods for bean definitions, specific to their bean definition format.

  Note that a bean definition reader does not have to implement this interface. It only serves as suggestion for bean definition readers that want to follow standard naming conventions.

  从以下版本开始:
    1.1
  作者:
    Juergen Hoeller
  另请参阅:
    `Resource`

- - ### 方法概要

    所有方法 实例方法 抽象方法
    限定符和类型 | 方法和说明
    --- | ---
    `ClassLoader` | `getBeanClassLoader()` Return the class loader to use for bean classes.
    `BeanNameGenerator` | `getBeanNameGenerator()` Return the BeanNameGenerator to use for anonymous beans (without explicit bean name specified).
    `BeanDefinitionRegistry` | `getRegistry()` Return the bean factory to register the bean definitions with.
    `org.springframework.core.io.ResourceLoader` | `getResourceLoader()` Return the resource loader to use for resource locations.
    `int` | `loadBeanDefinitions(org.springframework.core.io.Resource... resources)` Load bean definitions from the specified resources.
    `int` | `loadBeanDefinitions(org.springframework.core.io.Resource resource)` Load bean definitions from the specified resource.
    `int` | `loadBeanDefinitions(String... locations)` Load bean definitions from the specified resource locations.
    `int` | `loadBeanDefinitions(String location)` Load bean definitions from the specified resource location.

- - ### 方法详细资料

    - #### getRegistry

          BeanDefinitionRegistry getRegistry()

      Return the bean factory to register the bean definitions with.

      The factory is exposed through the BeanDefinitionRegistry interface, encapsulating the methods that are relevant for bean definition handling.

    - #### getResourceLoader

          @Nullable
          org.springframework.core.io.ResourceLoader getResourceLoader()

      Return the resource loader to use for resource locations. Can be checked for the ResourcePatternResolver interface and cast accordingly, for loading multiple resources for a given resource pattern.

      A `null` return value suggests that absolute resource loading is not available for this bean definition reader.

      This is mainly meant to be used for importing further resources from within a bean definition resource, for example via the "import" tag in XML bean definitions. It is recommended, however, to apply such imports relative to the defining resource; only explicit full resource locations will trigger absolute resource loading.

      There is also a `loadBeanDefinitions(String)` method available, for loading bean definitions from a resource location (or location pattern). This is a convenience to avoid explicit ResourceLoader handling.

      另请参阅:
        `loadBeanDefinitions(String)`, `ResourcePatternResolver`

    - #### getBeanClassLoader

          @Nullable
          ClassLoader getBeanClassLoader()

      Return the class loader to use for bean classes.

      `null` suggests to not load bean classes eagerly but rather to just register bean definitions with class names, with the corresponding Classes to be resolved later (or never).

    - #### getBeanNameGenerator

          BeanNameGenerator getBeanNameGenerator()

      Return the BeanNameGenerator to use for anonymous beans (without explicit bean name specified).

    - #### loadBeanDefinitions

          int loadBeanDefinitions(org.springframework.core.io.Resource resource)
                           throws BeanDefinitionStoreException

      Load bean definitions from the specified resource.
      参数:
        `resource` - the resource descriptor
      返回:
        the number of bean definitions found
      抛出:
        `BeanDefinitionStoreException` - in case of loading or parsing errors

    - #### loadBeanDefinitions

          int loadBeanDefinitions(org.springframework.core.io.Resource... resources)
                           throws BeanDefinitionStoreException

      Load bean definitions from the specified resources.
      参数:
        `resources` - the resource descriptors
      返回:
        the number of bean definitions found
      抛出:
        `BeanDefinitionStoreException` - in case of loading or parsing errors

    - #### loadBeanDefinitions

          int loadBeanDefinitions(String location)
                           throws BeanDefinitionStoreException

      Load bean definitions from the specified resource location.

      The location can also be a location pattern, provided that the ResourceLoader of this bean definition reader is a ResourcePatternResolver.

      参数:
        `location` - the resource location, to be loaded with the ResourceLoader (or ResourcePatternResolver) of this bean definition reader
      返回:
        the number of bean definitions found
      抛出:
        `BeanDefinitionStoreException` - in case of loading or parsing errors
      另请参阅:
        `getResourceLoader()`, `loadBeanDefinitions(org.springframework.core.io.Resource)`, `loadBeanDefinitions(org.springframework.core.io.Resource[])`

    - #### loadBeanDefinitions

          int loadBeanDefinitions(String... locations)
                           throws BeanDefinitionStoreException

      Load bean definitions from the specified resource locations.
      参数:
        `locations` - the resource locations, to be loaded with the ResourceLoader (or ResourcePatternResolver) of this bean definition reader
      返回:
        the number of bean definitions found
      抛出:
        `BeanDefinitionStoreException` - in case of loading or parsing errors