|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 ClassLoader |
classLoader
|
protected GenericApplicationContext |
context
|
protected ApplicationContext |
parent
|
Constructor Summary | |
---|---|
DefaultRuntimeSpringConfiguration()
|
|
DefaultRuntimeSpringConfiguration(ApplicationContext parent)
|
|
DefaultRuntimeSpringConfiguration(ApplicationContext parent,
ClassLoader cl)
|
Method Summary | |
---|---|
BeanConfiguration |
addAbstractBean(String name)
Adds an abstract bean and returns the BeanConfiguration instance |
void |
addAlias(String alias,
String beanName)
Adds an alias to a given bean name |
void |
addBeanConfiguration(String beanName,
BeanConfiguration beanConfiguration)
Adds a bean configuration to the list of beans to be created |
void |
addBeanDefinition(String name,
BeanDefinition bd)
Adds a Spring BeanDefinition. |
BeanConfiguration |
addPrototypeBean(String name)
Adds an empty prototype bean configuration |
BeanConfiguration |
addPrototypeBean(String name,
Class clazz)
Adds a prototype bean definition |
BeanConfiguration |
addSingletonBean(String name)
Adds an empty singleton bean configuration |
BeanConfiguration |
addSingletonBean(String name,
Class clazz)
Adds a singleton bean definition |
BeanConfiguration |
addSingletonBean(String name,
Class clazz,
Collection args)
Creates a new singleton bean and adds it to the list of bean references |
boolean |
containsBean(String name)
Returns whether the runtime spring config contains the specified bean |
protected GenericApplicationContext |
createApplicationContext(ApplicationContext parent)
Creates the ApplicationContext instance. |
AbstractBeanDefinition |
createBeanDefinition(String name)
Creates and returns the BeanDefinition that is regsitered within the given name or returns null |
BeanConfiguration |
createPrototypeBean(String name)
Creates a new prototype bean configuration. |
BeanConfiguration |
createSingletonBean(Class clazz)
Creates a singleton bean configuration. |
BeanConfiguration |
createSingletonBean(Class clazz,
Collection constructorArguments)
Creates a singleton bean configuration. |
BeanConfiguration |
createSingletonBean(String name)
Creates a new singleton bean configuration. |
ApplicationContext |
getApplicationContext()
Retrieves the application context from the current state |
BeanConfiguration |
getBeanConfig(String name)
Returns the BeanConfiguration for the specified name |
List |
getBeanNames()
|
ApplicationContext |
getUnrefreshedApplicationContext()
|
protected void |
initialiseApplicationContext()
Initialises the ApplicationContext instance |
void |
registerBeansWithContext(GenericApplicationContext applicationContext)
Registers the beans held within this RuntimeSpringConfiguration instance with the given ApplicationContext |
void |
registerPostProcessor(BeanFactoryPostProcessor processor)
Registers a bean factory post processor with the context |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected GenericApplicationContext context
protected ApplicationContext parent
protected ClassLoader classLoader
Constructor Detail |
---|
public DefaultRuntimeSpringConfiguration()
public DefaultRuntimeSpringConfiguration(ApplicationContext parent)
public DefaultRuntimeSpringConfiguration(ApplicationContext parent, ClassLoader cl)
Method Detail |
---|
protected GenericApplicationContext createApplicationContext(ApplicationContext parent)
parent
- The parent ApplicationContext instance. Can be null.
protected void initialiseApplicationContext()
public BeanConfiguration addSingletonBean(String name, Class clazz)
RuntimeSpringConfiguration
addSingletonBean
in interface RuntimeSpringConfiguration
name
- The name of the beanclazz
- The class of the bean
public BeanConfiguration addPrototypeBean(String name, Class clazz)
RuntimeSpringConfiguration
addPrototypeBean
in interface RuntimeSpringConfiguration
name
- The name of the beanclazz
- The class of the bean
public ApplicationContext getApplicationContext()
RuntimeSpringConfiguration
getApplicationContext
in interface RuntimeSpringConfiguration
public ApplicationContext getUnrefreshedApplicationContext()
getUnrefreshedApplicationContext
in interface RuntimeSpringConfiguration
public BeanConfiguration addSingletonBean(String name)
RuntimeSpringConfiguration
addSingletonBean
in interface RuntimeSpringConfiguration
name
- The name of the singleton bean
public BeanConfiguration createSingletonBean(Class clazz)
RuntimeSpringConfiguration
createSingletonBean
in interface RuntimeSpringConfiguration
public BeanConfiguration addSingletonBean(String name, Class clazz, Collection args)
RuntimeSpringConfiguration
addSingletonBean
in interface RuntimeSpringConfiguration
name
- The name of the beanclazz
- The class of the beanargs
- The constructor arguments of the bean
public BeanConfiguration addPrototypeBean(String name)
RuntimeSpringConfiguration
addPrototypeBean
in interface RuntimeSpringConfiguration
name
- The name of the prototype bean
public BeanConfiguration createSingletonBean(Class clazz, Collection constructorArguments)
RuntimeSpringConfiguration
createSingletonBean
in interface RuntimeSpringConfiguration
clazz
- The bean classconstructorArguments
- The constructor arguments
public BeanConfiguration createPrototypeBean(String name)
RuntimeSpringConfiguration
createPrototypeBean
in interface RuntimeSpringConfiguration
name
- The bean name
public BeanConfiguration createSingletonBean(String name)
RuntimeSpringConfiguration
createSingletonBean
in interface RuntimeSpringConfiguration
name
- The bean name
public void addBeanConfiguration(String beanName, BeanConfiguration beanConfiguration)
RuntimeSpringConfiguration
addBeanConfiguration
in interface RuntimeSpringConfiguration
beanName
- The name of the bean in the contextbeanConfiguration
- The BeanConfiguration instancepublic void addBeanDefinition(String name, BeanDefinition bd)
RuntimeSpringConfiguration
addBeanDefinition
in interface RuntimeSpringConfiguration
name
- The name of the beanbd
- The BeanDefinition instancepublic boolean containsBean(String name)
RuntimeSpringConfiguration
containsBean
in interface RuntimeSpringConfiguration
name
- The bean name
public BeanConfiguration getBeanConfig(String name)
RuntimeSpringConfiguration
getBeanConfig
in interface RuntimeSpringConfiguration
name
- The name of the bean configuration
public AbstractBeanDefinition createBeanDefinition(String name)
RuntimeSpringConfiguration
createBeanDefinition
in interface RuntimeSpringConfiguration
name
- The name of the bean definition
public void registerPostProcessor(BeanFactoryPostProcessor processor)
RuntimeSpringConfiguration
registerPostProcessor
in interface RuntimeSpringConfiguration
processor
- The BeanFactoryPostProcessor instancepublic List getBeanNames()
getBeanNames
in interface RuntimeSpringConfiguration
public void registerBeansWithContext(GenericApplicationContext applicationContext)
RuntimeSpringConfiguration
registerBeansWithContext
in interface RuntimeSpringConfiguration
applicationContext
- The ApplicationContext instancepublic BeanConfiguration addAbstractBean(String name)
addAbstractBean
in interface RuntimeSpringConfiguration
name
- The name of the bean
public void addAlias(String alias, String beanName)
RuntimeSpringConfiguration
addAlias
in interface RuntimeSpringConfiguration
alias
- The aliasbeanName
- The bean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |