接口 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

public interface ApplicationContext extends HierarchicalBeanFactory, MessageSource, ApplicationEventPublisher, cn.taketoday.core.io.PatternResourceLoader, cn.taketoday.core.env.EnvironmentCapable
Central interface to provide configuration for an application. This is read-only while the application is running, but may be reloaded if the implementation supports this.

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 ResourceLoader interface.
  • The ability to publish events to registered listeners. Inherited from the ApplicationEventPublisher interface.
  • The ability to resolve messages, supporting internationalization. Inherited from the MessageSource interface.
  • 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
另请参阅:
  • 字段详细资料

    • APPLICATION_NAME

      static final String APPLICATION_NAME
      从以下版本开始:
      4.0
      另请参阅:
  • 方法详细资料

    • getEnvironment

      cn.taketoday.core.env.Environment getEnvironment()
      Get Environment
      指定者:
      getEnvironment 在接口中 cn.taketoday.core.env.EnvironmentCapable
      返回:
      Environment
    • getBeanFactory

      BeanFactory getBeanFactory()
      Get AbstractBeanFactory
      返回:
      A bean factory
      从以下版本开始:
      3.0
    • unwrapFactory

      <T> T unwrapFactory(Class<T> requiredType)
      unwrap bean-factory to requiredType
      抛出:
      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

      Get context's state
      返回:
      context's state
      从以下版本开始:
      2.1.5
    • getId

      @Nullable String getId()
      Return the unique id of this application context.
      返回:
      the unique id of the context, or null if 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

      @Nullable ApplicationContext getParent()
      Return the parent context, or null if there is no parent and this is the root of the context hierarchy.
      返回:
      the parent context, or null if there is no parent
      从以下版本开始:
      4.0
    • getAutowireCapableBeanFactory

      AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException
      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 ConfigurableApplicationContext interface offers access to the AutowireCapableBeanFactory interface 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 the AutowireCapableBeanFactory interface, or does not hold an autowire-capable bean factory yet (e.g. if refresh() has never been called), or if the context has been closed already
      另请参阅:
    • getExpressionEvaluator

      ExpressionEvaluator getExpressionEvaluator()
      返回:
      ExpressionEvaluator of this context
      从以下版本开始:
      4.0