Package: org.grails.spring

## [Java] Class DefaultRuntimeSpringConfiguration

- org.grails.spring.DefaultRuntimeSpringConfiguration

- All Implemented Interfaces and Traits:
    RuntimeSpringConfiguration

      public class DefaultRuntimeSpringConfiguration
      extends java.lang.Object
      implements RuntimeSpringConfiguration

  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

  Authors:
    Graeme
  Since:
    0.3

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private static org.apache.commons.logging.Log` | `LOG` |
    `protected java.util.Map<java.lang.String, java.util.List<java.lang.String>>` | `aliases` |
    `private java.util.Map<java.lang.String, BeanConfiguration>` | `beanConfigs` |
    `private java.util.Map<java.lang.String, org.springframework.beans.factory.config.BeanDefinition>` | `beanDefinitions` |
    `protected org.springframework.beans.factory.ListableBeanFactory` | `beanFactory` |
    `private java.util.Set<java.lang.String>` | `beanNames` |
    `protected java.lang.ClassLoader` | `classLoader` |
    `protected org.springframework.context.support.GenericApplicationContext` | `context` |
    `protected org.springframework.context.ApplicationContext` | `parent` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `DefaultRuntimeSpringConfiguration ()`
    `DefaultRuntimeSpringConfiguration (org.springframework.context.ApplicationContext parent)`
    `DefaultRuntimeSpringConfiguration (org.springframework.context.ApplicationContext parent, java.lang.ClassLoader cl)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public BeanConfiguration` | `addAbstractBean(java.lang.String name)`
    `` | `public void` | `addAlias(java.lang.String alias, java.lang.String beanName)`
    `` | `public void` | `addBeanConfiguration(java.lang.String beanName, BeanConfiguration beanConfiguration)`
    `` | `public void` | `addBeanDefinition(java.lang.String name, org.springframework.beans.factory.config.BeanDefinition bd)`
    `` | `public BeanConfiguration` | `addPrototypeBean(java.lang.String name, java.lang.Class clazz)`
    `` | `public BeanConfiguration` | `addPrototypeBean(java.lang.String name)`
    `` | `public BeanConfiguration` | `addSingletonBean(java.lang.String name, java.lang.Class clazz)`
    `` | `public BeanConfiguration` | `addSingletonBean(java.lang.String name)`
    `` | `public BeanConfiguration` | `addSingletonBean(java.lang.String name, java.lang.Class clazz, java.util.Collection args)`
    `` | `public boolean` | `containsBean(java.lang.String name)`
    `` | `protected org.springframework.context.support.GenericApplicationContext` | `createApplicationContext(org.springframework.context.ApplicationContext parentCtx)` Creates the ApplicationContext instance.
    `` | `public org.springframework.beans.factory.support.AbstractBeanDefinition` | `createBeanDefinition(java.lang.String name)`
    `` | `public BeanConfiguration` | `createPrototypeBean(java.lang.String name)`
    `` | `public BeanConfiguration` | `createSingletonBean(java.lang.Class clazz)`
    `` | `public BeanConfiguration` | `createSingletonBean(java.lang.Class clazz, java.util.Collection constructorArguments)`
    `` | `public BeanConfiguration` | `createSingletonBean(java.lang.String name)`
    `` | `public org.springframework.context.ApplicationContext` | `getApplicationContext()`
    `` | `public BeanConfiguration` | `getBeanConfig(java.lang.String name)`
    `` | `public org.springframework.beans.factory.config.BeanDefinition` | `getBeanDefinition(java.lang.String beanName)`
    `` | `public java.util.List<java.lang.String>` | `getBeanNames()`
    `` | `public org.springframework.context.ApplicationContext` | `getUnrefreshedApplicationContext()`
    `` | `protected void` | `initialiseApplicationContext()` Initialises the ApplicationContext instance.
    `` | `private void` | `registerBeanAliasesWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry beanDefinitionRegistry)`
    `` | `private void` | `registerBeanConfigsWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)`
    `` | `private void` | `registerBeanConfiguration(java.lang.String name, BeanConfiguration bc)`
    `` | `private void` | `registerBeanDefinitionsWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)`
    `` | `public void` | `registerBeansWithConfig(RuntimeSpringConfiguration targetSpringConfig)`
    `` | `public void` | `registerBeansWithContext(org.springframework.context.support.GenericApplicationContext applicationContext)`
    `` | `public void` | `registerBeansWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)`
    `` | `public void` | `registerPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor processor)`
    `` | `private void` | `registerUnrefreshedBeansWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)`
    `` | `private void` | `removeBeanDefinition(org.springframework.beans.factory.support.BeanDefinitionRegistry registry, java.lang.String beanName)`
    `` | `public void` | `setBeanFactory(org.springframework.beans.factory.ListableBeanFactory beanFactory)`
    `` | `private void` | `setClassLoaderOnContext(java.lang.ClassLoader cl)`
    `` | `private void` | `trySettingClassLoaderOnContextIfFoundInParent(org.springframework.context.ApplicationContext parentCtx)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### private static final org.apache.commons.logging.Log LOG

    - #### protected java.util.Map<java.lang.String, java.util.List<java.lang.String>> aliases

    - #### private java.util.Map<java.lang.String, BeanConfiguration> beanConfigs

    - #### private java.util.Map<java.lang.String, org.springframework.beans.factory.config.BeanDefinition> beanDefinitions

    - #### protected org.springframework.beans.factory.ListableBeanFactory beanFactory

    - #### private java.util.Set<java.lang.String> beanNames

    - #### protected java.lang.ClassLoader classLoader

    - #### protected org.springframework.context.support.GenericApplicationContext context

    - #### protected org.springframework.context.ApplicationContext parent

  - ### Constructor Detail

    - #### public DefaultRuntimeSpringConfiguration()

    - #### public DefaultRuntimeSpringConfiguration(org.springframework.context.ApplicationContext parent)

    - #### public DefaultRuntimeSpringConfiguration(org.springframework.context.ApplicationContext parent, java.lang.ClassLoader cl)

  - ### Method Detail

    - #### public BeanConfiguration addAbstractBean(java.lang.String name)

    - #### public void addAlias(java.lang.String alias, java.lang.String beanName)

    - #### public void addBeanConfiguration(java.lang.String beanName, BeanConfiguration beanConfiguration)

    - #### public void addBeanDefinition(java.lang.String name, org.springframework.beans.factory.config.BeanDefinition bd)

    - #### public BeanConfiguration addPrototypeBean(java.lang.String name, @java.lang.SuppressWarnings("rawtypes") java.lang.Class clazz)

    - #### public BeanConfiguration addPrototypeBean(java.lang.String name)

    - #### public BeanConfiguration addSingletonBean(java.lang.String name, @java.lang.SuppressWarnings("rawtypes") java.lang.Class clazz)

    - #### public BeanConfiguration addSingletonBean(java.lang.String name)

    - #### @java.lang.SuppressWarnings("rawtypes") public BeanConfiguration addSingletonBean(java.lang.String name, java.lang.Class clazz, java.util.Collection args)

    - #### public boolean containsBean(java.lang.String name)

    - #### protected org.springframework.context.support.GenericApplicationContext createApplicationContext(org.springframework.context.ApplicationContext parentCtx)

      Creates the ApplicationContext instance. Subclasses can override to customise the used ApplicationContext

      Parameters:
        `parentCtx` - The parent ApplicationContext instance. Can be null.
      Returns:
        An instance of GenericApplicationContext

    - #### public org.springframework.beans.factory.support.AbstractBeanDefinition createBeanDefinition(java.lang.String name)

    - #### public BeanConfiguration createPrototypeBean(java.lang.String name)

    - #### public BeanConfiguration createSingletonBean(@java.lang.SuppressWarnings("rawtypes") java.lang.Class clazz)

    - #### @java.lang.SuppressWarnings("rawtypes") public BeanConfiguration createSingletonBean(java.lang.Class clazz, java.util.Collection constructorArguments)

    - #### public BeanConfiguration createSingletonBean(java.lang.String name)

    - #### public org.springframework.context.ApplicationContext getApplicationContext()

    - #### public BeanConfiguration getBeanConfig(java.lang.String name)

    - #### public org.springframework.beans.factory.config.BeanDefinition getBeanDefinition(java.lang.String beanName)

    - #### public java.util.List<java.lang.String> getBeanNames()

    - #### public org.springframework.context.ApplicationContext getUnrefreshedApplicationContext()

    - #### protected void initialiseApplicationContext()

      Initialises the ApplicationContext instance.

    - #### private void registerBeanAliasesWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry beanDefinitionRegistry)

    - #### private void registerBeanConfigsWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

    - #### private void registerBeanConfiguration(java.lang.String name, BeanConfiguration bc)

    - #### private void registerBeanDefinitionsWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

    - #### public void registerBeansWithConfig(RuntimeSpringConfiguration targetSpringConfig)

    - #### public void registerBeansWithContext(org.springframework.context.support.GenericApplicationContext applicationContext)

    - #### public void registerBeansWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

    - #### public void registerPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor processor)

    - #### private void registerUnrefreshedBeansWithRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

    - #### private void removeBeanDefinition(org.springframework.beans.factory.support.BeanDefinitionRegistry registry, java.lang.String beanName)

    - #### public void setBeanFactory(org.springframework.beans.factory.ListableBeanFactory beanFactory)

    - #### private void setClassLoaderOnContext(java.lang.ClassLoader cl)

    - #### private void trySettingClassLoaderOnContextIfFoundInParent(org.springframework.context.ApplicationContext parentCtx)