接口 ConfigurableApplicationContext
- 所有超级接口:
ApplicationContext,ApplicationEventPublisher,AutoCloseable,BeanFactory,Closeable,DependencyInjectorProvider,cn.taketoday.core.env.EnvironmentCapable,HierarchicalBeanFactory,Lifecycle,MessageSource,cn.taketoday.core.io.PatternResourceLoader,cn.taketoday.core.io.ResourceLoader
- 所有已知实现类:
AbstractApplicationContext,AbstractRefreshableApplicationContext,AbstractRefreshableConfigApplicationContext,AbstractXmlApplicationContext,AnnotationConfigApplicationContext,ClassPathXmlApplicationContext,FileSystemXmlApplicationContext,GenericApplicationContext,GenericXmlApplicationContext,StandardApplicationContext,StaticApplicationContext
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.
- 作者:
- Juergen Hoeller, Chris Beams, Sam Brannen, TODAY 2018-11-14 21:16
-
嵌套类概要
从接口继承的嵌套类/接口 cn.taketoday.context.ApplicationContext
ApplicationContext.State -
字段概要
字段修饰符和类型字段说明static final StringAny number of these characters are considered delimiters between multiple context config paths in a single String value.static final StringName of the ConversionService bean in the factory.static final StringName of the LoadTimeWeaver bean in the factory.static final StringNameof the shutdown hook thread: "ContextShutdownHook".从接口继承的字段 cn.taketoday.context.ApplicationContext
APPLICATION_NAME从接口继承的字段 cn.taketoday.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX从接口继承的字段 cn.taketoday.core.io.PatternResourceLoader
CLASSPATH_ALL_URL_PREFIX从接口继承的字段 cn.taketoday.core.io.ResourceLoader
CLASSPATH_URL_PREFIX -
方法概要
修饰符和类型方法说明voidaddApplicationListener(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(cn.taketoday.core.io.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.Get AbstractBeanFactorycn.taketoday.core.env.ConfigurableEnvironmentGet configurable environmentbooleanisActive()Determine whether this application context is active, that is, whether it has been refreshed at least once and has not been closed yet.voidrefresh()Load or refresh the persistent representation of the configuration, which might be from Java-based configuration 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(cn.taketoday.context.ApplicationListener<?>)before.voidsetClassLoader(ClassLoader classLoader) Specify the ClassLoader to load class path resources and bean classes with.voidsetEnvironment(cn.taketoday.core.env.ConfigurableEnvironment environment) Set theEnvironmentfor this application context.voidSet the unique id of this application context.voidsetParent(ApplicationContext parent) Set the parent of this application context.从接口继承的方法 cn.taketoday.context.ApplicationContext
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getExpressionEvaluator, getId, getParent, getStartupDate, getState, hasStarted, unwrapFactory从接口继承的方法 cn.taketoday.context.ApplicationEventPublisher
publishEvent从接口继承的方法 cn.taketoday.beans.factory.BeanFactory
containsBean, containsBeanDefinition, findAnnotationOnBean, findAnnotationOnBean, findSynthesizedAnnotation, getAliases, getAnnotatedBeans, getBean, getBean, getBean, getBean, getBean, getBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitions, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeans, getBeansOfType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getBeansWithAnnotation, getObjectSupplier, getObjectSupplier, getObjectSupplier, getObjectSupplier, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch, unwrap从接口继承的方法 cn.taketoday.beans.factory.support.DependencyInjectorProvider
getInjector从接口继承的方法 cn.taketoday.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory从接口继承的方法 cn.taketoday.context.MessageSource
getMessage, getMessage, getMessage从接口继承的方法 cn.taketoday.core.io.PatternResourceLoader
getResources, getResourcesArray, scan从接口继承的方法 cn.taketoday.core.io.ResourceLoader
getClassLoader, getResource
-
字段详细资料
-
CONFIG_LOCATION_DELIMITERS
Any number of these characters are considered delimiters between multiple context config paths in a single String value.- 另请参阅:
-
CONVERSION_SERVICE_BEAN_NAME
Name of the ConversionService bean in the factory. If none is supplied, default conversion rules apply.- 从以下版本开始:
- 4.0
- 另请参阅:
-
ConversionService- 常量字段值
-
LOAD_TIME_WEAVER_BEAN_NAME
Name of the LoadTimeWeaver bean in the factory. If such a bean is supplied, the context will use a temporary ClassLoader for type matching, in order to allow the LoadTimeWeaver to process all actual bean classes.- 从以下版本开始:
- 4.0
- 另请参阅:
-
SHUTDOWN_HOOK_THREAD_NAME
Nameof the shutdown hook thread: "ContextShutdownHook".- 从以下版本开始:
- 4.0
- 另请参阅:
-
-
方法详细资料
-
getEnvironment
cn.taketoday.core.env.ConfigurableEnvironment getEnvironment()Get configurable environment- 指定者:
getEnvironment在接口中ApplicationContext- 指定者:
getEnvironment在接口中cn.taketoday.core.env.EnvironmentCapable- 返回:
ConfigurableEnvironmentnever be null- 从以下版本开始:
- 2.1.0
-
getBeanFactory
ConfigurableBeanFactory getBeanFactory()Get AbstractBeanFactory- 指定者:
getBeanFactory在接口中ApplicationContext- 返回:
- A bean factory
-
addBeanFactoryPostProcessor
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.- 参数:
postProcessor- the factory processor to register- 从以下版本开始:
- 2.1.7
-
setId
Set the unique id of this application context.- 从以下版本开始:
- 4.0
-
setParent
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.
- 参数:
parent- the parent context- 从以下版本开始:
- 4.0
-
setEnvironment
void setEnvironment(cn.taketoday.core.env.ConfigurableEnvironment environment) Set theEnvironmentfor this application context.- 参数:
environment- the new environment- 从以下版本开始:
- 4.0
-
addProtocolResolver
void addProtocolResolver(cn.taketoday.core.io.ProtocolResolver resolver) Register the given protocol resolver with this application context, allowing for additional resource protocols to be handled.Any such resolver will be invoked ahead of this context's standard resolution rules. It may therefore also override any default rules.
- 从以下版本开始:
- 4.0
-
setClassLoader
Specify the ClassLoader to load class path resources and bean classes with.This context class loader will be passed to the internal bean factory.
- 从以下版本开始:
- 4.0
- 另请参阅:
-
DefaultResourceLoader(ClassLoader)
-
refresh
Load or refresh the persistent representation of the configuration, which might be from Java-based configuration or some other format.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 this method, either all or no singletons at all should be instantiated.
- 抛出:
ApplicationContextException- if the bean factory could not be initializedIllegalStateException- if already initialized and multiple refresh attempts are not supported- 从以下版本开始:
- 2.0.1
-
registerShutdownHook
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. Only one shutdown hook (at max) will be registered for each context instance.
The name of the shutdown hook thread should be
SHUTDOWN_HOOK_THREAD_NAME. -
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
closeon a parent context; parent contexts have their own, independent lifecycle.This method can be called multiple times without side effects: Subsequent
closecalls on an already closed context will be ignored.- 指定者:
close在接口中ApplicationContext- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable
-
addApplicationListener
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 if the context is not active yet, or on the fly with the current event multicaster in case of a context that is already active.
- 参数:
listener- the ApplicationListener to register- 从以下版本开始:
- 4.0
- 另请参阅:
-
removeApplicationListener
Remove the given ApplicationListener from this context's set of listeners, assuming it got registered viaaddApplicationListener(cn.taketoday.context.ApplicationListener<?>)before.- 参数:
listener- the ApplicationListener to deregister- 从以下版本开始:
- 4.0
-
isActive
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.- 返回:
- whether the context is still active
- 从以下版本开始:
- 4.0
- 另请参阅:
-