org.springframework.context.annotation

## 类 ConfigurationClassPostProcessor

- java.lang.Object
- - org.springframework.context.annotation.ConfigurationClassPostProcessor

- 所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, EnvironmentAware, ResourceLoaderAware, org.springframework.core.Ordered, org.springframework.core.PriorityOrdered

      public class ConfigurationClassPostProcessor
      extends Object
      implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.core.PriorityOrdered, ResourceLoaderAware, org.springframework.beans.factory.BeanClassLoaderAware, EnvironmentAware

  `BeanFactoryPostProcessor` used for bootstrapping processing of `@Configuration` classes.

  Registered by default when using `<context:annotation-config/>` or `<context:component-scan/>`. Otherwise, may be declared manually as with any other BeanFactoryPostProcessor.

  This post processor is priority-ordered as it is important that any `Bean` methods declared in `@Configuration` classes have their corresponding bean definitions registered before any other `BeanFactoryPostProcessor` executes.

  从以下版本开始:
    3.0
  作者:
    Chris Beams, Juergen Hoeller, Phillip Webb

- - ### 字段概要

    - ### 从接口继承的字段 org.springframework.core.Ordered

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### 构造器概要

    构造器
    构造器和说明
    `ConfigurationClassPostProcessor()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `enhanceConfigurationClasses(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)` Post-processes a BeanFactory in search of Configuration class BeanDefinitions; any candidates are then enhanced by a `ConfigurationClassEnhancer`.
    `int` | `getOrder()`
    `void` | `postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)` Derive further bean definitions from the configuration classes in the registry.
    `void` | `postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)` Prepare the Configuration classes for servicing bean requests at runtime by replacing them with CGLIB-enhanced subclasses.
    `void` | `processConfigBeanDefinitions(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)` Build and validate a configuration model based on the registry of `Configuration` classes.
    `void` | `setBeanClassLoader(ClassLoader beanClassLoader)`
    `void` | `setBeanNameGenerator(org.springframework.beans.factory.support.BeanNameGenerator beanNameGenerator)` Set the `BeanNameGenerator` to be used when triggering component scanning from `Configuration` classes and when registering `Import`'ed configuration classes.
    `void` | `setEnvironment(org.springframework.core.env.Environment environment)` Set the `Environment` that this component runs in.
    `void` | `setMetadataReaderFactory(org.springframework.core.type.classreading.MetadataReaderFactory metadataReaderFactory)` Set the `MetadataReaderFactory` to use.
    `void` | `setProblemReporter(org.springframework.beans.factory.parsing.ProblemReporter problemReporter)` Set the `ProblemReporter` to use.
    `void` | `setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)` Set the ResourceLoader that this object runs in.
    `void` | `setSourceExtractor(org.springframework.beans.factory.parsing.SourceExtractor sourceExtractor)` Set the `SourceExtractor` to use for generated bean definitions that correspond to `Bean` factory methods.

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

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

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

    - #### ConfigurationClassPostProcessor

          public ConfigurationClassPostProcessor()

  - ### 方法详细资料

    - #### getOrder

          public int getOrder()

      指定者:
        `getOrder` 在接口中 `org.springframework.core.Ordered`

    - #### setSourceExtractor

          public void setSourceExtractor(@Nullable
                                         org.springframework.beans.factory.parsing.SourceExtractor sourceExtractor)

      Set the `SourceExtractor` to use for generated bean definitions that correspond to `Bean` factory methods.

    - #### setProblemReporter

          public void setProblemReporter(@Nullable
                                         org.springframework.beans.factory.parsing.ProblemReporter problemReporter)

      Set the `ProblemReporter` to use.

      Used to register any problems detected with `Configuration` or `Bean` declarations. For instance, an @Bean method marked as `final` is illegal and would be reported as a problem. Defaults to `FailFastProblemReporter`.

    - #### setMetadataReaderFactory

          public void setMetadataReaderFactory(org.springframework.core.type.classreading.MetadataReaderFactory metadataReaderFactory)

      Set the `MetadataReaderFactory` to use.

      Default is a `CachingMetadataReaderFactory` for the specified bean class loader.

    - #### setBeanNameGenerator

          public void setBeanNameGenerator(org.springframework.beans.factory.support.BeanNameGenerator beanNameGenerator)

      Set the `BeanNameGenerator` to be used when triggering component scanning from `Configuration` classes and when registering `Import`'ed configuration classes. The default is a standard `AnnotationBeanNameGenerator` for scanned components (compatible with the default in `ClassPathBeanDefinitionScanner`) and a variant thereof for imported configuration classes (using unique fully-qualified class names instead of standard component overriding).

      Note that this strategy does not apply to `Bean` methods.

      This setter is typically only appropriate when configuring the post-processor as a standalone bean definition in XML, e.g. not using the dedicated `AnnotationConfig*` application contexts or the `<context:annotation-config>` element. Any bean name generator specified against the application context will take precedence over any value set here.

      从以下版本开始:
        3.1.1
      另请参阅:
        `AnnotationConfigApplicationContext.setBeanNameGenerator(BeanNameGenerator)`, `AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR`

    - #### setEnvironment

          public void setEnvironment(org.springframework.core.env.Environment environment)

      从接口复制的说明: `EnvironmentAware`
      Set the `Environment` that this component runs in.
      指定者:
        `setEnvironment` 在接口中 `EnvironmentAware`

    - #### setResourceLoader

          public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)

      从接口复制的说明: `ResourceLoaderAware`
      Set the ResourceLoader that this object runs in.

      This might be a ResourcePatternResolver, which can be checked through `instanceof ResourcePatternResolver`. See also the `ResourcePatternUtils.getResourcePatternResolver` method.

      Invoked after population of normal bean properties but before an init callback like InitializingBean's `afterPropertiesSet` or a custom init-method. Invoked before ApplicationContextAware's `setApplicationContext`.

      指定者:
        `setResourceLoader` 在接口中 `ResourceLoaderAware`
      参数:
        `resourceLoader` - the ResourceLoader object to be used by this object
      另请参阅:
        `ResourcePatternResolver`, `ResourcePatternUtils.getResourcePatternResolver(org.springframework.core.io.ResourceLoader)`

    - #### setBeanClassLoader

          public void setBeanClassLoader(ClassLoader beanClassLoader)

      指定者:
        `setBeanClassLoader` 在接口中 `org.springframework.beans.factory.BeanClassLoaderAware`

    - #### postProcessBeanDefinitionRegistry

          public void postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

      Derive further bean definitions from the configuration classes in the registry.
      指定者:
        `postProcessBeanDefinitionRegistry` 在接口中 `org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor`

    - #### postProcessBeanFactory

          public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

      Prepare the Configuration classes for servicing bean requests at runtime by replacing them with CGLIB-enhanced subclasses.
      指定者:
        `postProcessBeanFactory` 在接口中 `org.springframework.beans.factory.config.BeanFactoryPostProcessor`

    - #### processConfigBeanDefinitions

          public void processConfigBeanDefinitions(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

      Build and validate a configuration model based on the registry of `Configuration` classes.

    - #### enhanceConfigurationClasses

          public void enhanceConfigurationClasses(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

      Post-processes a BeanFactory in search of Configuration class BeanDefinitions; any candidates are then enhanced by a `ConfigurationClassEnhancer`. Candidate status is determined by BeanDefinition attribute metadata.
      另请参阅:
        `ConfigurationClassEnhancer`