|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.config.java.process.ConfigurationProcessor
public class ConfigurationProcessor
For internal use only. Processes Configuration beans.
A Configuration bean contains bean definition methods annotated with the Bean annotation. The Configuration class itself may optionally be annotated with a Configuration annotation setting global defaults.
Bean creation methods may be public or protected.
Typically used for only one configuration class in a single BeanDefinitionRegistry.
Most of the actual work is performed by ConfigurationListeners, which makes the processing of this class extensible. ConfigurationListeners react to configuration methods and classes.
The process work on configurations created from classes but also object instances.
This class implements InitializingBean
interface - remember to call
InitializingBean.afterPropertiesSet()
before any processing.
ConfigurationListener
Field Summary | |
---|---|
protected Log |
log
|
Constructor Summary | |
---|---|
ConfigurationProcessor(ConfigurableApplicationContext ac)
Constructor taking an application context as parameter. |
|
ConfigurationProcessor(ConfigurableListableBeanFactory clbf)
Create a configuration processor. |
Method Summary | |
---|---|
void |
addValueSource(ValueSource vs)
|
void |
afterPropertiesSet()
Called to avoid constructor changes every time a new configuration switch appears on this class. |
protected void |
generateBeanDefinitionFromBeanCreationMethod(ConfigurableListableBeanFactory beanFactory,
String configurerBeanName,
Class<?> configurerClass,
String beanName,
Method beanCreationMethod,
Bean beanAnnotation)
Generate the actual bean definition using the given method. |
protected void |
generateBeanDefinitions(String configurationBeanName,
Class<?> configurationClass)
Modify metadata by emitting new bean definitions based on the bean creation methods in this Java bytecode. |
BeanFactory |
getChildBeanFactory()
|
ResourceLoader |
getResourceLoader()
|
static boolean |
isConfigurationClass(Class<?> candidateConfigurationClass)
Check if the given class is a configuration. |
int |
processClass(Class<?> configurationClass)
Generate bean definitions from a 'naked' configuration class. |
void |
registerBeanDefinition(String name,
BeanDefinition bd,
boolean hide)
|
void |
registerSingleton(String name,
Object o,
boolean hide)
|
void |
setBeanNamingStrategy(BeanNamingStrategy beanNamingStrategy)
Optionally indicate the naming strategy used for creating the bean names during processing. |
void |
setConfigurationListenerRegistry(org.springframework.config.java.process.ConfigurationListenerRegistry configurationListenerRegistry)
Optionally specify a custom subclass of ConfigurationListenerRegistry . |
void |
setResourceLoader(ResourceLoader resourceLoader)
Optionally indicate the resourceLoader. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Log log
Constructor Detail |
---|
public ConfigurationProcessor(ConfigurableApplicationContext ac)
ac
- application context in which the newly created bean definition
will residepublic ConfigurationProcessor(ConfigurableListableBeanFactory clbf)
clbf
- owning factoryMethod Detail |
---|
public void setResourceLoader(ResourceLoader resourceLoader)
DefaultResourceLoader
will be used. will be used.
setResourceLoader
in interface ResourceLoaderAware
resourceLoader
- public ResourceLoader getResourceLoader()
public void setBeanNamingStrategy(BeanNamingStrategy beanNamingStrategy)
beanNamingStrategy
- bean naming strategy implementationpublic void setConfigurationListenerRegistry(org.springframework.config.java.process.ConfigurationListenerRegistry configurationListenerRegistry)
ConfigurationListenerRegistry
. If unspecified, the default
implementation will be used.
TODO: if ConfigurationListener is made internal, this configuration
should be eliminated as well
configurationListenerRegistry
- public void addValueSource(ValueSource vs)
public BeanFactory getChildBeanFactory()
public void registerBeanDefinition(String name, BeanDefinition bd, boolean hide)
public void registerSingleton(String name, Object o, boolean hide)
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public int processClass(Class<?> configurationClass) throws BeanDefinitionStoreException
configurationClass
- class containing @Configurable or @Bean
annotation
BeanDefinitionStoreException
- if no bean definitions are foundprotected void generateBeanDefinitions(String configurationBeanName, Class<?> configurationClass)
configurationBeanName
- name of the bean containing the factory
methodsconfigurationClass
- enhanced configuration classprotected void generateBeanDefinitionFromBeanCreationMethod(ConfigurableListableBeanFactory beanFactory, String configurerBeanName, Class<?> configurerClass, String beanName, Method beanCreationMethod, Bean beanAnnotation)
beanFactory
- containing beanFactoryconfigurerBeanName
- the configuration nameconfigurerClass
- configuration classbeanCreationMethod
- method creating the actual beanbeanAnnotation
- the Bean annotation available on the creation
method.public static boolean isConfigurationClass(Class<?> candidateConfigurationClass)
candidateConfigurationClass
- - must be non-abstract and be
annotated with @Configuration and/or have at least one method
annotated with @Bean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |