站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

ConfigurableApplicationContext (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.context
Interface ConfigurableApplicationContext

All Superinterfaces:
ApplicationContext, ApplicationEventPublisher, BeanFactory, HierarchicalBeanFactory, ListableBeanFactory, MessageSource, ResourceLoader, ResourcePatternResolver
All Known Subinterfaces:
ConfigurableWebApplicationContext
All Known Implementing Classes:
AbstractApplicationContext, AbstractRefreshableApplicationContext, AbstractRefreshableWebApplicationContext, AbstractXmlApplicationContext, ClassPathXmlApplicationContext, FileSystemXmlApplicationContext, GenericApplicationContext, GenericWebApplicationContext, StaticApplicationContext, StaticWebApplicationContext, XmlWebApplicationContext

public interface ConfigurableApplicationContext
extends ApplicationContext

SPI interface to be implemented by most if not all application contexts. Provides means to configure an application context in addition to the application context client methods in the ApplicationContext interface.

Configuration and lifecycle methods are encapsulated here to avoid making them obvious to ApplicationContext client code.

Since:
03.11.2003
Author:
Juergen Hoeller

Field Summary
 
Fields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX
 
Fields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX
 
Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX, CLASSPATH_URL_PREFIX
 
Method Summary
 void addBeanFactoryPostProcessor(BeanFactoryPostProcessor beanFactoryPostProcessor)
          Add a new BeanFactoryPostProcessor that will get applied to the internal bean factory of this application context on refresh, before any of the bean definitions get evaluated.
 void close()
          Close this application context, releasing all resources and locks that the implementation might hold.
 ConfigurableListableBeanFactory getBeanFactory()
          Return the internal bean factory of this application context.
 void refresh()
          Load or refresh the persistent representation of the configuration, which might an XML file, properties file, or relational database schema.
 void setParent(ApplicationContext parent)
          Set the parent of this application context.
 
Methods inherited from interface org.springframework.context.ApplicationContext
getDisplayName, getParent, getStartupDate, publishEvent
 
Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType
 
Methods inherited from interface org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getType, isSingleton
 
Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory
 
Methods inherited from interface org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getType, isSingleton
 
Methods inherited from interface org.springframework.context.MessageSource
getMessage, getMessage, getMessage
 
Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver
getResources
 
Methods inherited from interface org.springframework.core.io.ResourceLoader
getResource
 

Method Detail

setParent

void setParent(ApplicationContext parent)
Set the parent of this application context.

Note that the parent shouldn't be changed: It should only be set outside a constructor if it isn't available when an object of this class is created, for example in case of WebApplicationContext setup.

Parameters:
parent - the parent context
See Also:
ConfigurableWebApplicationContext

addBeanFactoryPostProcessor

void addBeanFactoryPostProcessor(BeanFactoryPostProcessor beanFactoryPostProcessor)
Add a new BeanFactoryPostProcessor that will get applied to the internal bean factory of this application context on refresh, before any of the bean definitions get evaluated. To be invoked during context configuration.

Parameters:
beanFactoryPostProcessor - the factory processor to register

refresh

void refresh()
             throws BeansException,
                    IllegalStateException
Load or refresh the persistent representation of the configuration, which might an XML file, properties file, or relational database schema.

Throws:
BeansException - if the bean factory could not be initialized
IllegalStateException - if already initialized and multiple refresh attempts are not supported

getBeanFactory

ConfigurableListableBeanFactory getBeanFactory()
                                               throws IllegalStateException
Return the internal bean factory of this application context. Can be used to access specific functionality of the factory.

Note: Do not use this to post-process the bean factory; singletons will already have been instantiated before. Use a BeanFactoryPostProcessor to intercept the bean factory setup process before beans get touched.

Throws:
IllegalStateException - if the context does not hold an internal bean factory yet (usually if refresh has never been called)
See Also:
refresh(), addBeanFactoryPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor)

close

void close()
Close this application context, releasing all resources and locks that the implementation might hold. This includes destroying all cached singleton beans.

Note: Does not invoke close on a parent context.



Copyright (c) 2002-2007 The Spring Framework Project.