org.springframework.context.annotation
Class ConfigurationClassBeanDefinitionReader

java.lang.Object
  extended by org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader

 class ConfigurationClassBeanDefinitionReader
extends java.lang.Object

Reads a given fully-populated configuration model, registering bean definitions with the given BeanDefinitionRegistry based on its contents.

This class was modeled after the BeanDefinitionReader hierarchy, but does not implement/extend any of its artifacts as a configuration model is not a Resource.

Since:
3.0
Author:
Chris Beams, Juergen Hoeller
See Also:
ConfigurationClassParser

Nested Class Summary
private static class ConfigurationClassBeanDefinitionReader.ConfigurationClassBeanDefinition
          RootBeanDefinition marker subclass used to signify that a bean definition created from a configuration class as opposed to any other configuration source.
private static class ConfigurationClassBeanDefinitionReader.InvalidConfigurationImportProblem
          Configuration classes must be annotated with @Configuration or declare at least one @Bean method.
 
Field Summary
private static java.lang.String CONFIGURATION_CLASS_ATTRIBUTE
           
private static java.lang.String CONFIGURATION_CLASS_FULL
           
private static java.lang.String CONFIGURATION_CLASS_LITE
           
private static Log logger
           
private  MetadataReaderFactory metadataReaderFactory
           
private  ProblemReporter problemReporter
           
private  BeanDefinitionRegistry registry
           
private  SourceExtractor sourceExtractor
           
 
Constructor Summary
ConfigurationClassBeanDefinitionReader(BeanDefinitionRegistry registry, SourceExtractor sourceExtractor, ProblemReporter problemReporter, MetadataReaderFactory metadataReaderFactory)
          Create a new ConfigurationClassBeanDefinitionReader instance that will be used to populate the given BeanDefinitionRegistry.
 
Method Summary
static boolean checkConfigurationClassCandidate(BeanDefinition beanDef, MetadataReaderFactory metadataReaderFactory)
          Check whether the given bean definition is a candidate for a configuration class, and mark it accordingly.
private  void doLoadBeanDefinitionForConfigurationClassIfNecessary(ConfigurationClass configClass)
          Registers the Configuration class itself as a bean definition.
static boolean isFullConfigurationClass(BeanDefinition beanDef)
          Determine whether the given bean definition indicates a full @Configuration class.
 void loadBeanDefinitions(java.util.Set<ConfigurationClass> configurationModel)
          Reads configurationModel, registering bean definitions with registry based on its contents.
private  void loadBeanDefinitionsForConfigurationClass(ConfigurationClass configClass)
          Reads a particular ConfigurationClass, registering bean definitions for the class itself, all its Bean methods
private  void loadBeanDefinitionsForModelMethod(ConfigurationClassMethod method)
          Reads a particular ConfigurationClassMethod, registering bean definitions with the BeanDefinitionRegistry based on its contents.
private  void loadBeanDefinitionsFromImportedResources(java.util.Map<java.lang.String,java.lang.Class<?>> importedResources)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIGURATION_CLASS_FULL

private static final java.lang.String CONFIGURATION_CLASS_FULL
See Also:
Constant Field Values

CONFIGURATION_CLASS_LITE

private static final java.lang.String CONFIGURATION_CLASS_LITE
See Also:
Constant Field Values

CONFIGURATION_CLASS_ATTRIBUTE

private static final java.lang.String CONFIGURATION_CLASS_ATTRIBUTE

logger

private static final Log logger

registry

private final BeanDefinitionRegistry registry

sourceExtractor

private final SourceExtractor sourceExtractor

problemReporter

private final ProblemReporter problemReporter

metadataReaderFactory

private final MetadataReaderFactory metadataReaderFactory
Constructor Detail

ConfigurationClassBeanDefinitionReader

public ConfigurationClassBeanDefinitionReader(BeanDefinitionRegistry registry,
                                              SourceExtractor sourceExtractor,
                                              ProblemReporter problemReporter,
                                              MetadataReaderFactory metadataReaderFactory)
Create a new ConfigurationClassBeanDefinitionReader instance that will be used to populate the given BeanDefinitionRegistry.

Parameters:
problemReporter -
metadataReaderFactory -
Method Detail

loadBeanDefinitions

public void loadBeanDefinitions(java.util.Set<ConfigurationClass> configurationModel)
Reads configurationModel, registering bean definitions with registry based on its contents.


loadBeanDefinitionsForConfigurationClass

private void loadBeanDefinitionsForConfigurationClass(ConfigurationClass configClass)
Reads a particular ConfigurationClass, registering bean definitions for the class itself, all its Bean methods


doLoadBeanDefinitionForConfigurationClassIfNecessary

private void doLoadBeanDefinitionForConfigurationClassIfNecessary(ConfigurationClass configClass)
Registers the Configuration class itself as a bean definition.


loadBeanDefinitionsForModelMethod

private void loadBeanDefinitionsForModelMethod(ConfigurationClassMethod method)
Reads a particular ConfigurationClassMethod, registering bean definitions with the BeanDefinitionRegistry based on its contents.


loadBeanDefinitionsFromImportedResources

private void loadBeanDefinitionsFromImportedResources(java.util.Map<java.lang.String,java.lang.Class<?>> importedResources)

checkConfigurationClassCandidate

public static boolean checkConfigurationClassCandidate(BeanDefinition beanDef,
                                                       MetadataReaderFactory metadataReaderFactory)
Check whether the given bean definition is a candidate for a configuration class, and mark it accordingly.

Parameters:
beanDef - the bean definition to check
metadataReaderFactory - the current factory in use by the caller
Returns:
whether the candidate qualifies as (any kind of) configuration class

isFullConfigurationClass

public static boolean isFullConfigurationClass(BeanDefinition beanDef)
Determine whether the given bean definition indicates a full @Configuration class.