|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.groovy.grails.commons.spring.DefaultRuntimeSpringConfiguration
public class DefaultRuntimeSpringConfiguration
A programmable runtime Spring configuration that allows a spring ApplicationContext to be constructed at runtime. Credit must go to Solomon Duskis and the article: http://jroller.com/page/Solomon?entry=programmatic_configuration_in_spring
| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
aliases
|
protected org.springframework.beans.factory.ListableBeanFactory |
beanFactory
|
protected java.lang.ClassLoader |
classLoader
|
protected org.springframework.context.support.GenericApplicationContext |
context
|
protected org.springframework.context.ApplicationContext |
parent
|
| Constructor Summary | |
|---|---|
DefaultRuntimeSpringConfiguration()
|
|
DefaultRuntimeSpringConfiguration(org.springframework.context.ApplicationContext parent)
|
|
DefaultRuntimeSpringConfiguration(org.springframework.context.ApplicationContext parent,
java.lang.ClassLoader cl)
|
|
| Method Summary | |
|---|---|
BeanConfiguration |
addAbstractBean(java.lang.String name)
\ Adds an abstract bean definition to the bean factory and returns the BeanConfiguration object. |
void |
addAlias(java.lang.String alias,
java.lang.String beanName)
Adds an alias to a given bean name. |
void |
addBeanConfiguration(java.lang.String beanName,
BeanConfiguration beanConfiguration)
Adds a bean configuration to the list of beans to be created. |
void |
addBeanDefinition(java.lang.String name,
org.springframework.beans.factory.config.BeanDefinition bd)
Adds a Spring BeanDefinition. |
BeanConfiguration |
addPrototypeBean(java.lang.String name)
Adds an empty prototype bean configuration. |
BeanConfiguration |
addPrototypeBean(java.lang.String name,
java.lang.Class clazz)
Adds a prototype bean definition. |
BeanConfiguration |
addSingletonBean(java.lang.String name)
Adds an empty singleton bean configuration. |
BeanConfiguration |
addSingletonBean(java.lang.String name,
java.lang.Class clazz)
Adds a singleton bean definition. |
BeanConfiguration |
addSingletonBean(java.lang.String name,
java.lang.Class clazz,
java.util.Collection args)
Creates a new singleton bean and adds it to the list of bean references. |
boolean |
containsBean(java.lang.String name)
Returns whether the runtime spring config contains the specified bean. |
protected org.springframework.context.support.GenericApplicationContext |
createApplicationContext(org.springframework.context.ApplicationContext parentCtx)
Creates the ApplicationContext instance. |
org.springframework.beans.factory.support.AbstractBeanDefinition |
createBeanDefinition(java.lang.String name)
Creates and returns the BeanDefinition that is regsitered within the given name or returns null. |
BeanConfiguration |
createPrototypeBean(java.lang.String name)
Creates a new prototype bean configuration. |
BeanConfiguration |
createSingletonBean(java.lang.Class clazz)
Creates a singleton bean configuration. |
BeanConfiguration |
createSingletonBean(java.lang.Class clazz,
java.util.Collection constructorArguments)
Creates a singleton bean configuration. |
BeanConfiguration |
createSingletonBean(java.lang.String name)
Creates a new singleton bean configuration. |
org.springframework.context.ApplicationContext |
getApplicationContext()
Retrieves the application context from the current state. |
BeanConfiguration |
getBeanConfig(java.lang.String name)
Returns the BeanConfiguration for the specified name. |
org.springframework.beans.factory.config.BeanDefinition |
getBeanDefinition(java.lang.String beanName)
Obtains a BeanDefinition instance for the given beanName. |
java.util.List<java.lang.String> |
getBeanNames()
|
org.springframework.context.ApplicationContext |
getUnrefreshedApplicationContext()
|
protected void |
initialiseApplicationContext()
Initialises the ApplicationContext instance. |
void |
registerBeansWithConfig(RuntimeSpringConfiguration targetSpringConfig)
Registers the beans held within this RuntimeSpringConfiguration instance with the given RuntimeSpringConfiguration. |
void |
registerBeansWithContext(org.springframework.context.support.GenericApplicationContext applicationContext)
Registers the beans held within this RuntimeSpringConfiguration instance with the given ApplicationContext. |
void |
registerBeansWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
Registers the beans held within this RuntimeSpringConfiguration instance with the given BeanDefinitionRegistry. |
void |
registerPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor processor)
Registers a bean factory post processor with the context. |
void |
setBeanFactory(org.springframework.beans.factory.ListableBeanFactory beanFactory)
Sets the BeanFactory implementation to use. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.springframework.context.support.GenericApplicationContext context
protected org.springframework.context.ApplicationContext parent
protected java.lang.ClassLoader classLoader
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> aliases
protected org.springframework.beans.factory.ListableBeanFactory beanFactory
| Constructor Detail |
|---|
public DefaultRuntimeSpringConfiguration()
public DefaultRuntimeSpringConfiguration(org.springframework.context.ApplicationContext parent)
public DefaultRuntimeSpringConfiguration(org.springframework.context.ApplicationContext parent,
java.lang.ClassLoader cl)
| Method Detail |
|---|
protected org.springframework.context.support.GenericApplicationContext createApplicationContext(org.springframework.context.ApplicationContext parentCtx)
parentCtx - The parent ApplicationContext instance. Can be null.
protected void initialiseApplicationContext()
public BeanConfiguration addSingletonBean(java.lang.String name,
java.lang.Class clazz)
RuntimeSpringConfiguration
addSingletonBean in interface RuntimeSpringConfigurationname - The name of the beanclazz - The class of the bean
public BeanConfiguration addPrototypeBean(java.lang.String name,
java.lang.Class clazz)
RuntimeSpringConfiguration
addPrototypeBean in interface RuntimeSpringConfigurationname - The name of the beanclazz - The class of the bean
public org.springframework.context.ApplicationContext getApplicationContext()
RuntimeSpringConfiguration
getApplicationContext in interface RuntimeSpringConfigurationpublic org.springframework.context.ApplicationContext getUnrefreshedApplicationContext()
getUnrefreshedApplicationContext in interface RuntimeSpringConfigurationpublic BeanConfiguration addSingletonBean(java.lang.String name)
RuntimeSpringConfiguration
addSingletonBean in interface RuntimeSpringConfigurationname - The name of the singleton bean
public BeanConfiguration createSingletonBean(java.lang.Class clazz)
RuntimeSpringConfiguration
createSingletonBean in interface RuntimeSpringConfiguration
public BeanConfiguration addSingletonBean(java.lang.String name,
java.lang.Class clazz,
java.util.Collection args)
RuntimeSpringConfiguration
addSingletonBean in interface RuntimeSpringConfigurationname - The name of the beanclazz - The class of the beanargs - The constructor arguments of the bean
public BeanConfiguration addPrototypeBean(java.lang.String name)
RuntimeSpringConfiguration
addPrototypeBean in interface RuntimeSpringConfigurationname - The name of the prototype bean
public BeanConfiguration createSingletonBean(java.lang.Class clazz,
java.util.Collection constructorArguments)
RuntimeSpringConfiguration
createSingletonBean in interface RuntimeSpringConfigurationclazz - The bean classconstructorArguments - The constructor arguments
public BeanConfiguration createPrototypeBean(java.lang.String name)
RuntimeSpringConfiguration
createPrototypeBean in interface RuntimeSpringConfigurationname - The bean name
public BeanConfiguration createSingletonBean(java.lang.String name)
RuntimeSpringConfiguration
createSingletonBean in interface RuntimeSpringConfigurationname - The bean name
public void addBeanConfiguration(java.lang.String beanName,
BeanConfiguration beanConfiguration)
RuntimeSpringConfiguration
addBeanConfiguration in interface RuntimeSpringConfigurationbeanName - The name of the bean in the contextbeanConfiguration - The BeanConfiguration instance
public void addBeanDefinition(java.lang.String name,
org.springframework.beans.factory.config.BeanDefinition bd)
RuntimeSpringConfiguration
addBeanDefinition in interface RuntimeSpringConfigurationname - The name of the beanbd - The BeanDefinition instancepublic boolean containsBean(java.lang.String name)
RuntimeSpringConfiguration
containsBean in interface RuntimeSpringConfigurationname - The bean name
public BeanConfiguration getBeanConfig(java.lang.String name)
RuntimeSpringConfiguration
getBeanConfig in interface RuntimeSpringConfigurationname - The name of the bean configuration
public org.springframework.beans.factory.support.AbstractBeanDefinition createBeanDefinition(java.lang.String name)
RuntimeSpringConfiguration
createBeanDefinition in interface RuntimeSpringConfigurationname - The name of the bean definition
public void registerPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor processor)
RuntimeSpringConfiguration
registerPostProcessor in interface RuntimeSpringConfigurationprocessor - The BeanFactoryPostProcessor instancepublic java.util.List<java.lang.String> getBeanNames()
getBeanNames in interface RuntimeSpringConfigurationpublic void registerBeansWithContext(org.springframework.context.support.GenericApplicationContext applicationContext)
RuntimeSpringConfiguration
registerBeansWithContext in interface RuntimeSpringConfigurationapplicationContext - The ApplicationContext instancepublic void registerBeansWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
RuntimeSpringConfiguration
registerBeansWithRegistry in interface RuntimeSpringConfigurationregistry - The BeanDefinitionRegistry instancepublic void registerBeansWithConfig(RuntimeSpringConfiguration targetSpringConfig)
RuntimeSpringConfiguration
registerBeansWithConfig in interface RuntimeSpringConfigurationtargetSpringConfig - The RuntimeSpringConfiguration instancepublic BeanConfiguration addAbstractBean(java.lang.String name)
RuntimeSpringConfiguration
addAbstractBean in interface RuntimeSpringConfigurationname - The name of the bean
public void addAlias(java.lang.String alias,
java.lang.String beanName)
RuntimeSpringConfiguration
addAlias in interface RuntimeSpringConfigurationalias - The aliasbeanName - The beanpublic org.springframework.beans.factory.config.BeanDefinition getBeanDefinition(java.lang.String beanName)
RuntimeSpringConfiguration
getBeanDefinition in interface RuntimeSpringConfigurationbeanName - The beanName
public void setBeanFactory(org.springframework.beans.factory.ListableBeanFactory beanFactory)
RuntimeSpringConfiguration
setBeanFactory in interface RuntimeSpringConfigurationbeanFactory - The BeanFactory implementation
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||