接口 ApplicationContext
- 所有超级接口:
ApplicationEventPublisher,BeanFactory,DependencyInjectorProvider,cn.taketoday.core.env.EnvironmentCapable,HierarchicalBeanFactory,MessageSource,cn.taketoday.core.io.PatternResourceLoader,cn.taketoday.core.io.ResourceLoader
- 所有已知子接口:
ConfigurableApplicationContext
- 所有已知实现类:
AbstractApplicationContext,AbstractRefreshableApplicationContext,AbstractRefreshableConfigApplicationContext,AbstractXmlApplicationContext,AnnotationConfigApplicationContext,ClassPathXmlApplicationContext,FileSystemXmlApplicationContext,GenericApplicationContext,GenericXmlApplicationContext,StandardApplicationContext,StaticApplicationContext
An ApplicationContext provides:
- Bean factory methods for accessing application components.
Inherited from
BeanFactory. - The ability to load file resources in a generic fashion.
Inherited from the
ResourceLoaderinterface. - The ability to publish events to registered listeners.
Inherited from the
ApplicationEventPublisherinterface. - The ability to resolve messages, supporting internationalization.
Inherited from the
MessageSourceinterface. - Inheritance from a parent context. Definitions in a descendant context will always take priority. This means, for example, that a single parent context can be used by an entire web application, while each servlet has its own child context that is independent of that of any other servlet.
In addition to standard BeanFactory
lifecycle capabilities, ApplicationContext implementations detect and invoke
ApplicationContextAware beans as well as ResourceLoaderAware,
ApplicationEventPublisherAware and MessageSourceAware beans.
- 从以下版本开始:
- 2018-06-23 16:39:36
- 作者:
- Rod Johnson, Juergen Hoeller, TODAY
- 另请参阅:
-
ConfigurableApplicationContextBeanFactoryResourceLoader
-
嵌套类概要
嵌套类 -
字段概要
字段从接口继承的字段 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 -
方法概要
修饰符和类型方法说明voidclose()Close context and destroy all singletonsReturn a name for the deployed application that this context belongs to.Expose AutowireCapableBeanFactory functionality for this context.Get AbstractBeanFactoryReturn a friendly name for this context.cn.taketoday.core.env.EnvironmentGetEnvironmentgetId()Return the unique id of this application context.Return the parent context, ornullif there is no parent and this is the root of the context hierarchy.longGet the context startup time stampgetState()Get context's statebooleanContext has started<T> TunwrapFactory(Class<T> requiredType) unwrap bean-factory torequiredType从接口继承的方法 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
-
字段详细资料
-
APPLICATION_NAME
- 从以下版本开始:
- 4.0
- 另请参阅:
-
Environment- 常量字段值
-
-
方法详细资料
-
getEnvironment
cn.taketoday.core.env.Environment getEnvironment()GetEnvironment- 指定者:
getEnvironment在接口中cn.taketoday.core.env.EnvironmentCapable- 返回:
Environment
-
getBeanFactory
BeanFactory getBeanFactory()Get AbstractBeanFactory- 返回:
- A bean factory
- 从以下版本开始:
- 3.0
-
unwrapFactory
unwrap bean-factory torequiredType- 抛出:
IllegalArgumentException- not a requiredType- 从以下版本开始:
- 4.0
- 另请参阅:
-
close
void close()Close context and destroy all singletons -
hasStarted
boolean hasStarted()Context has started- 返回:
- is started
-
getStartupDate
long getStartupDate()Get the context startup time stamp- 返回:
- startup timestamp
-
getState
ApplicationContext.State getState()Get context's state- 返回:
- context's state
- 从以下版本开始:
- 2.1.5
-
getId
Return the unique id of this application context.- 返回:
- the unique id of the context, or
nullif none - 从以下版本开始:
- 4.0
-
getApplicationName
String getApplicationName()Return a name for the deployed application that this context belongs to.- 返回:
- a name for the deployed application, or the empty String by default
- 从以下版本开始:
- 4.0
-
getDisplayName
String getDisplayName()Return a friendly name for this context.- 返回:
- a display name for this context (never
null) - 从以下版本开始:
- 4.0
-
getParent
Return the parent context, ornullif there is no parent and this is the root of the context hierarchy.- 返回:
- the parent context, or
nullif there is no parent - 从以下版本开始:
- 4.0
-
getAutowireCapableBeanFactory
Expose AutowireCapableBeanFactory functionality for this context.This is not typically used by application code, except for the purpose of initializing bean instances that live outside of the application context, applying the bean lifecycle (fully or partly) to them.
Alternatively, the internal BeanFactory exposed by the
ConfigurableApplicationContextinterface offers access to theAutowireCapableBeanFactoryinterface too. The present method mainly serves as a convenient, specific facility on the ApplicationContext interface.NOTE: this method will consistently throw IllegalStateException after the application context has been closed. In current Framework versions, only refreshable application contexts behave that way; all application context implementations will be required to comply.
- 返回:
- the AutowireCapableBeanFactory for this context
- 抛出:
IllegalStateException- if the context does not support theAutowireCapableBeanFactoryinterface, or does not hold an autowire-capable bean factory yet (e.g. ifrefresh()has never been called), or if the context has been closed already- 另请参阅:
-
getExpressionEvaluator
ExpressionEvaluator getExpressionEvaluator()- 返回:
- ExpressionEvaluator of this context
- 从以下版本开始:
- 4.0
-