org.springframework.context.support
Class StaticApplicationContext

org.springframework.context.support.AbstractApplicationContext
  |
  +--org.springframework.context.support.StaticApplicationContext
Direct Known Subclasses:
StaticUiApplicationContext

public class StaticApplicationContext
extends AbstractApplicationContext

ApplicationContext to allow concrete registration of Java objects in code, rather than from external configuration sources. Mainly useful for testing.

Author:
Rod Johnson

Fields inherited from class org.springframework.context.support.AbstractApplicationContext
MESSAGE_SOURCE_BEAN_NAME

Constructor Summary
StaticApplicationContext()
          Create new StaticApplicationContext.
StaticApplicationContext(ApplicationContext parent)
          Create new StaticApplicationContext with the given parent.

Method Summary
 voidaddMessage(String code, Locale locale, String defaultMessage)
          Associate the given message with the given code.
 ConfigurableListableBeanFactorygetBeanFactory()
          Return underlying bean factory for super class.
 DefaultListableBeanFactorygetDefaultListableBeanFactory()
          Return the underlying bean factory of this context.
 voidregisterPrototype(String name, Class clazz, MutablePropertyValues pvs)
          Register a prototype bean with the default bean factory.
 voidregisterSingleton(String name, Class clazz, MutablePropertyValues pvs)
          Register a singleton bean with the default bean factory.

Methods inherited from class org.springframework.context.support.AbstractApplicationContext
close, containsBean, containsBeanDefinition, getAliases, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeansOfType, getDisplayName, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResource, getStartupDate, isSingleton, publishEvent, refresh, setParent, toString

Constructor Detail

StaticApplicationContext

public StaticApplicationContext()
throws org.springframework.beans.BeansException
Create new StaticApplicationContext.

StaticApplicationContext

public StaticApplicationContext(ApplicationContext parent)
throws org.springframework.beans.BeansException
Create new StaticApplicationContext with the given parent.
Parameters:
parent - the parent application context
Method Detail

addMessage

public void addMessage(String code, Locale locale, String defaultMessage)
Associate the given message with the given code.
Parameters:
code - lookup code
locale - locale message should be found within
defaultMessage - message associated with this lookup code

getBeanFactory

public ConfigurableListableBeanFactory getBeanFactory()
Return underlying bean factory for super class.

getDefaultListableBeanFactory

public DefaultListableBeanFactory getDefaultListableBeanFactory()
Return the underlying bean factory of this context.

registerPrototype

public void registerPrototype(String name, Class clazz, MutablePropertyValues pvs)
throws org.springframework.beans.BeansException
Register a prototype bean with the default bean factory.

registerSingleton

public void registerSingleton(String name, Class clazz, MutablePropertyValues pvs)
throws org.springframework.beans.BeansException
Register a singleton bean with the default bean factory.

Association Links

to Class org.springframework.beans.factory.support.DefaultListableBeanFactory