org.springframework.context.support
Class StaticApplicationContext
java.lang.Object
org.springframework.core.io.DefaultResourceLoader
org.springframework.context.support.AbstractApplicationContext
org.springframework.context.support.GenericApplicationContext
org.springframework.context.support.StaticApplicationContext
- All Implemented Interfaces:
- ApplicationContext, ApplicationEventPublisher, BeanDefinitionRegistry, BeanFactory, ConfigurableApplicationContext, HierarchicalBeanFactory, ListableBeanFactory, MessageSource, ResourceLoader, ResourcePatternResolver
- Direct Known Subclasses:
- StaticWebApplicationContext
- public class StaticApplicationContext
- extends GenericApplicationContext
ApplicationContext that allows concrete registration of beans and
messages in code, rather than from external configuration sources.
Mainly useful for testing.
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
registerSingleton(java.lang.String, java.lang.Class, org.springframework.beans.MutablePropertyValues)
,
registerPrototype(java.lang.String, java.lang.Class, org.springframework.beans.MutablePropertyValues)
,
GenericApplicationContext.registerBeanDefinition(java.lang.String, org.springframework.beans.factory.config.BeanDefinition)
,
AbstractApplicationContext.refresh()
Methods inherited from class org.springframework.context.support.AbstractApplicationContext |
addBeanFactoryPostProcessor, addListener, close, containsBean, containsBeanDefinition, getAliases, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeansOfType, getBeansOfType, getDisplayName, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResourcePatternResolver, getResources, getStartupDate, getType, isSingleton, onRefresh, postProcessBeanFactory, publishEvent, refresh, setDisplayName, setParent, toString |
StaticApplicationContext
public StaticApplicationContext()
throws BeansException
- Create a new StaticApplicationContext.
- See Also:
registerSingleton(java.lang.String, java.lang.Class, org.springframework.beans.MutablePropertyValues)
,
registerPrototype(java.lang.String, java.lang.Class, org.springframework.beans.MutablePropertyValues)
,
GenericApplicationContext.registerBeanDefinition(java.lang.String, org.springframework.beans.factory.config.BeanDefinition)
,
AbstractApplicationContext.refresh()
StaticApplicationContext
public StaticApplicationContext(ApplicationContext parent)
throws BeansException
- Create a new StaticApplicationContext with the given parent.
- See Also:
registerSingleton(java.lang.String, java.lang.Class, org.springframework.beans.MutablePropertyValues)
,
registerPrototype(java.lang.String, java.lang.Class, org.springframework.beans.MutablePropertyValues)
,
GenericApplicationContext.registerBeanDefinition(java.lang.String, org.springframework.beans.factory.config.BeanDefinition)
,
AbstractApplicationContext.refresh()
getStaticMessageSource
public StaticMessageSource getStaticMessageSource()
- Return the internal StaticMessageSource used by this context.
Can be used to register messages on it.
- See Also:
addMessage(java.lang.String, java.util.Locale, java.lang.String)
registerSingleton
public void registerSingleton(String name,
Class clazz,
MutablePropertyValues pvs)
throws BeansException
- Register a singleton bean with the default bean factory.
- Throws:
BeansException
registerPrototype
public void registerPrototype(String name,
Class clazz,
MutablePropertyValues pvs)
throws BeansException
- Register a prototype bean with the default bean factory.
- Throws:
BeansException
addMessage
public void addMessage(String code,
Locale locale,
String defaultMessage)
- Associate the given message with the given code.
- Parameters:
code
- lookup codelocale
- locale message should be found withindefaultMessage
- message associated with this lookup code
Copyright (C) 2003-2004 The Spring Framework Project.