Interface ConfigurableApplicationContext
- All Superinterfaces:
ApplicationContext, ApplicationEventPublisher, AutoCloseable, BeanFactory, Closeable, EnvironmentCapable, HierarchicalBeanFactory, Lifecycle, ListableBeanFactory, MessageSource, ResourceLoader, ResourcePatternResolver
- All Known Subinterfaces:
ConfigurableWebApplicationContext
- All Known Implementing Classes:
AbstractApplicationContext, AbstractRefreshableApplicationContext, AbstractRefreshableConfigApplicationContext, AbstractRefreshableWebApplicationContext, AbstractXmlApplicationContext, AnnotationConfigApplicationContext, AnnotationConfigWebApplicationContext, ClassPathXmlApplicationContext, FileSystemXmlApplicationContext, GenericApplicationContext, GenericGroovyApplicationContext, GenericWebApplicationContext, GenericXmlApplicationContext, GroovyWebApplicationContext, StaticApplicationContext, StaticWebApplicationContext, XmlWebApplicationContext
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
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.
- Since:
- 03.11.2003
- Author:
- Juergen Hoeller, Chris Beams, Sam Brannen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of theApplicationStartupbean in the factory: "applicationStartup".static final StringThe name of the bootstrap executor bean in the context: "bootstrapExecutor".static final StringAny number of these characters are considered delimiters between multiple context config paths in a singleStringvalue: ",; \t\n".static final StringName of theConversionServicebean in the factory: "conversionService".static final StringName of theEnvironmentbean in the factory: "environment".static final StringName of theLoadTimeWeaverbean in the factory: "loadTimeWeaver".static final StringName of the shutdown hook thread: "SpringContextShutdownHook".static final StringName of the Operating System environment bean in the factory: "systemEnvironment".static final StringName of the JVM System properties bean in the factory: "systemProperties".Fields inherited from interface BeanFactory
FACTORY_BEAN_PREFIX, FACTORY_BEAN_PREFIX_CHARFields inherited from interface ResourceLoader
CLASSPATH_URL_PREFIXFields inherited from interface ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX -
Method Summary
Modifier and TypeMethodDescriptionvoidaddApplicationListener(ApplicationListener<?> listener) Add a new ApplicationListener that will be notified on context events such as context refresh and context shutdown.voidaddBeanFactoryPostProcessor(BeanFactoryPostProcessor postProcessor) 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.voidaddProtocolResolver(ProtocolResolver resolver) Register the given protocol resolver with this application context, allowing for additional resource protocols to be handled.voidclose()Close this application context, releasing all resources and locks that the implementation might hold.Return theApplicationStartupfor this application context.Return the internal bean factory of this application context.Return theEnvironmentfor this application context in configurable form, allowing for further customization.booleanisActive()Determine whether this application context is active, that is, whether it has been refreshed at least once and has not been closed yet.booleanisClosed()Return whether this context has been closed already, that is, whetherclose()has been called on an active context in order to initiate its shutdown.voidpause()Stop all beans in this application context unless they explicitly opt out of pausing throughSmartLifecycle.isPauseable()returningfalse.voidrefresh()Load or refresh the persistent representation of the configuration, which might be from Java-based configuration, an XML file, a properties file, a relational database schema, or some other format.voidRegister a shutdown hook with the JVM runtime, closing this context on JVM shutdown unless it has already been closed at that time.voidremoveApplicationListener(ApplicationListener<?> listener) Remove the given ApplicationListener from this context's set of listeners, assuming it got registered viaaddApplicationListener(ApplicationListener)before.voidrestart()Pause all beans in this application context if necessary, and subsequently restart all auto-startup beans, effectively restoring the lifecycle state afterrefresh()(typically after a precedingpause()call when a fullLifecycle.start()of even lazy-starting beans is to be avoided).voidsetApplicationStartup(ApplicationStartup applicationStartup) Set theApplicationStartupfor this application context.voidsetClassLoader(ClassLoader classLoader) Specify the ClassLoader to load class path resources and bean classes with.voidsetEnvironment(ConfigurableEnvironment environment) Set theEnvironmentfor this application context.voidSet the unique ID of this application context.voidsetParent(@Nullable ApplicationContext parent) Set the parent of this application context.Methods inherited from interface ApplicationContext
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDateMethods inherited from interface ApplicationEventPublisher
publishEvent, publishEventMethods inherited from interface BeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatchMethods inherited from interface HierarchicalBeanFactory
containsLocalBean, getParentBeanFactoryMethods inherited from interface ListableBeanFactory
containsBeanDefinition, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotationMethods inherited from interface MessageSource
getMessage, getMessage, getMessageMethods inherited from interface