| org.springframework.context.ConfigurableApplicationContext
All known Subclasses: org.springframework.context.support.AbstractApplicationContext,
ConfigurableApplicationContext | public interface ConfigurableApplicationContext extends ApplicationContext,Lifecycle(Code) | | SPI interface to be implemented by most if not all application contexts.
Provides facilities to configure an application context in addition
to the application context client methods in the
org.springframework.context.ApplicationContext interface.
Configuration and lifecycle methods are encapsulated here to avoid
making them obvious to ApplicationContext client code. The present
methods should only be used by startup and shutdown code.
author: Juergen Hoeller since: 03.11.2003 |
Method Summary | |
void | addApplicationListener(ApplicationListener listener) Add a new ApplicationListener that will be notified on context events
such as context refresh and context shutdown.
Note that any ApplicationListener registered here will be applied
on refresh of this context. | 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.
Can be used to access specific functionality of the underlying factory.
Note: Do not use this to post-process the bean factory; singletons
will already have been instantiated before. | boolean | isActive() Determine whether this application context is active, that is,
whether it has been refreshed at least once and has not been closed yet. | void | refresh() Load or refresh the persistent representation of the configuration,
which might an XML file, properties file, or relational database schema.
As this is a startup method, it should destroy already created singletons
if it fails, to avoid dangling resources. | void | registerShutdownHook() Register a shutdown hook with the JVM runtime, closing this context
on JVM shutdown unless it has already been closed at that time.
This method can be called multiple times. | void | setParent(ApplicationContext parent) Set the parent of this application context. |
addBeanFactoryPostProcessor | void addBeanFactoryPostProcessor(BeanFactoryPostProcessor beanFactoryPostProcessor)(Code) | | 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 |
close | void close()(Code) | | 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;
parent contexts have their own, independent lifecycle.
This method can be called multiple times without side effects: Subsequent
close calls on an already closed context will be ignored.
|
refresh | void refresh() throws BeansException, IllegalStateException(Code) | | Load or refresh the persistent representation of the configuration,
which might an XML file, properties file, or relational database schema.
As this is a startup method, it should destroy already created singletons
if it fails, to avoid dangling resources. In other words, after invocation
of that method, either all or no singletons at all should be instantiated.
throws: BeansException - if the bean factory could not be initialized throws: IllegalStateException - if already initialized and multiple refreshattempts are not supported |
registerShutdownHook | void registerShutdownHook()(Code) | | Register a shutdown hook with the JVM runtime, closing this context
on JVM shutdown unless it has already been closed at that time.
This method can be called multiple times. Only one shutdown hook
(at max) will be registered for each context instance.
See Also: java.lang.Runtime.addShutdownHook See Also: ConfigurableApplicationContext.close() |
|
|