org.springframework.context.support

## 类 AbstractApplicationContext

- java.lang.Object
- - org.springframework.core.io.DefaultResourceLoader
  - - org.springframework.context.support.AbstractApplicationContext

- 所有已实现的接口:
    Closeable, AutoCloseable, org.springframework.beans.factory.BeanFactory, org.springframework.beans.factory.HierarchicalBeanFactory, org.springframework.beans.factory.ListableBeanFactory, ApplicationContext, ApplicationEventPublisher, ConfigurableApplicationContext, Lifecycle, MessageSource, org.springframework.core.env.EnvironmentCapable, org.springframework.core.io.ResourceLoader, org.springframework.core.io.support.ResourcePatternResolver
  直接已知子类:
    AbstractRefreshableApplicationContext, GenericApplicationContext

      public abstract class AbstractApplicationContext
      extends org.springframework.core.io.DefaultResourceLoader
      implements ConfigurableApplicationContext

  Abstract implementation of the `ApplicationContext` interface. Doesn't mandate the type of storage used for configuration; simply implements common context functionality. Uses the Template Method design pattern, requiring concrete subclasses to implement abstract methods.

  In contrast to a plain BeanFactory, an ApplicationContext is supposed to detect special beans defined in its internal bean factory: Therefore, this class automatically registers `BeanFactoryPostProcessors`, `BeanPostProcessors`, and `ApplicationListeners` which are defined as beans in the context.

  A `MessageSource` may also be supplied as a bean in the context, with the name "messageSource"; otherwise, message resolution is delegated to the parent context. Furthermore, a multicaster for application events can be supplied as an "applicationEventMulticaster" bean of type `ApplicationEventMulticaster` in the context; otherwise, a default multicaster of type `SimpleApplicationEventMulticaster` will be used.

  Implements resource loading by extending `DefaultResourceLoader`. Consequently treats non-URL resource paths as class path resources (supporting full class path resource names that include the package path, e.g. "mypackage/myresource.dat"), unless the `DefaultResourceLoader.getResourceByPath(java.lang.String)` method is overridden in a subclass.

  从以下版本开始:
    January 21, 2001
  作者:
    Rod Johnson, Juergen Hoeller, Mark Fisher, Stephane Nicoll
  另请参阅:
    `refreshBeanFactory()`, `getBeanFactory()`, `BeanFactoryPostProcessor`, `BeanPostProcessor`, `ApplicationEventMulticaster`, `ApplicationListener`, `MessageSource`

- - ### 嵌套类概要

    - ### 从类继承的嵌套类/接口 org.springframework.core.io.DefaultResourceLoader

      `org.springframework.core.io.DefaultResourceLoader.ClassPathContextResource`

  - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static String` | `APPLICATION_EVENT_MULTICASTER_BEAN_NAME` Name of the ApplicationEventMulticaster bean in the factory.
    `static String` | `LIFECYCLE_PROCESSOR_BEAN_NAME` Name of the LifecycleProcessor bean in the factory.
    `protected Log` | `logger` Logger used by this class.
    `static String` | `MESSAGE_SOURCE_BEAN_NAME` Name of the MessageSource bean in the factory.

    - ### 从接口继承的字段 org.springframework.context.ConfigurableApplicationContext

      `CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME`

    - ### 从接口继承的字段 org.springframework.beans.factory.BeanFactory

      `FACTORY_BEAN_PREFIX`

    - ### 从接口继承的字段 org.springframework.core.io.support.ResourcePatternResolver

      `CLASSPATH_ALL_URL_PREFIX`

    - ### 从接口继承的字段 org.springframework.core.io.ResourceLoader

      `CLASSPATH_URL_PREFIX`

  - ### 构造器概要

    构造器
    构造器和说明
    `AbstractApplicationContext()` Create a new AbstractApplicationContext with no parent.
    `AbstractApplicationContext(ApplicationContext parent)` Create a new AbstractApplicationContext with the given parent context.

  - ### 方法概要

    所有方法 实例方法 抽象方法 具体方法 已过时的方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `addApplicationListener(ApplicationListener<?> listener)` Add a new ApplicationListener that will be notified on context events such as context refresh and context shutdown.
    `void` | `addBeanFactoryPostProcessor(org.springframework.beans.factory.config.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.
    `protected void` | `assertBeanFactoryActive()` Assert that this context's BeanFactory is currently active, throwing an `IllegalStateException` if it isn't.
    `protected void` | `cancelRefresh(org.springframework.beans.BeansException ex)` Cancel this context's refresh attempt, resetting the `active` flag after an exception got thrown.
    `void` | `close()` Close this application context, destroying all beans in its bean factory.
    `protected abstract void` | `closeBeanFactory()` Subclasses must implement this method to release their internal bean factory.
    `boolean` | `containsBean(String name)`
    `boolean` | `containsBeanDefinition(String beanName)`
    `boolean` | `containsLocalBean(String name)`
    `protected org.springframework.core.env.ConfigurableEnvironment` | `createEnvironment()` Create and return a new `StandardEnvironment`.
    `void` | `destroy()` 已过时。 as of Spring Framework 5.0, in favor of `close()`
    `protected void` | `destroyBeans()` Template method for destroying all beans that this context manages.
    `protected void` | `doClose()` Actually performs context closing: publishes a ContextClosedEvent and destroys the singletons in the bean factory of this application context.
    `<A extends Annotation> A` | `findAnnotationOnBean(String beanName, Class<A> annotationType)`
    `protected void` | `finishBeanFactoryInitialization(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)` Finish the initialization of this context's bean factory, initializing all remaining singleton beans.
    `protected void` | `finishRefresh()` Finish the refresh of this context, invoking the LifecycleProcessor's onRefresh() method and publishing the `ContextRefreshedEvent`.
    `String[]` | `getAliases(String name)`
    `Collection<ApplicationListener<?>>` | `getApplicationListeners()` IOC 容器的刷新
    `String` | `getApplicationName()` Return a name for the deployed application that this context belongs to.
    `org.springframework.beans.factory.config.AutowireCapableBeanFactory` | `getAutowireCapableBeanFactory()` Return this context's internal bean factory as AutowireCapableBeanFactory, if already available.
    `<T> T` | `getBean(Class<T> requiredType)`
    `<T> T` | `getBean(Class<T> requiredType, Object... args)`
    `Object` | `getBean(String name)`
    `<T> T` | `getBean(String name, Class<T> requiredType)`
    `Object` | `getBean(String name, Object... args)`
    `int` | `getBeanDefinitionCount()`
    `String[]` | `getBeanDefinitionNames()`
    `abstract org.springframework.beans.factory.config.ConfigurableListableBeanFactory` | `getBeanFactory()` Subclasses must return their internal bean factory here.
    `List<org.springframework.beans.factory.config.BeanFactoryPostProcessor>` | `getBeanFactoryPostProcessors()` Return the list of BeanFactoryPostProcessors that will get applied to the internal BeanFactory.
    `String[]` | `getBeanNamesForAnnotation(Class<? extends Annotation> annotationType)`
    `String[]` | `getBeanNamesForType(Class<?> type)`
    `String[]` | `getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)`
    `String[]` | `getBeanNamesForType(org.springframework.core.ResolvableType type)`
    `<T> Map<String,T>` | `getBeansOfType(Class<T> type)`
    `<T> Map<String,T>` | `getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)`
    `Map<String,Object>` | `getBeansWithAnnotation(Class<? extends Annotation> annotationType)`
    `String` | `getDisplayName()` Return a friendly name for this context.
    `org.springframework.core.env.ConfigurableEnvironment` | `getEnvironment()` Return the `Environment` for this application context in configurable form, allowing for further customization.
    `String` | `getId()` Return the unique id of this application context.
    `protected org.springframework.beans.factory.BeanFactory` | `getInternalParentBeanFactory()` 方法实现说明:获取我们spring上下文对象的父上下文，然后通过父上下文获取父工厂 Spring 根的上下文对象不会有父容器，但是我们的springmvc就在这里存在父工厂.
    `protected MessageSource` | `getInternalParentMessageSource()` Return the internal message source of the parent context if it is an AbstractApplicationContext too; else, return the parent context itself.
    `String` | `getMessage(MessageSourceResolvable resolvable, Locale locale)` Try to resolve the message using all the attributes contained within the `MessageSourceResolvable` argument that was passed in.
    `String` | `getMessage(String code, Object[] args, Locale locale)` Try to resolve the message.
    `String` | `getMessage(String code, Object[] args, String defaultMessage, Locale locale)` Try to resolve the message.
    `ApplicationContext` | `getParent()` Return the parent context, or `null` if there is no parent (that is, this context is the root of the context hierarchy).
    `org.springframework.beans.factory.BeanFactory` | `getParentBeanFactory()`
    `protected org.springframework.core.io.support.ResourcePatternResolver` | `getResourcePatternResolver()` Return the ResourcePatternResolver to use for resolving location patterns into Resource instances.
    `org.springframework.core.io.Resource[]` | `getResources(String locationPattern)`
    `long` | `getStartupDate()` Return the timestamp (ms) when this context was first loaded.
    `Class<?>` | `getType(String name)`
    `protected void` | `initApplicationEventMulticaster()` 从bean工厂中获取或者直接显示的new一个多播器赋值给我们的applicatoinContext对象 采用典型的设计模式就是观察者模式 多播器作为的是一个被观察者
    `protected void` | `initLifecycleProcessor()` Initialize the LifecycleProcessor.
    `protected void` | `initMessageSource()` Initialize the MessageSource.
    `protected void` | `initPropertySources()` Replace any stub property sources with actual instances.
    `protected void` | `invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)` Instantiate and invoke all registered BeanFactoryPostProcessor beans, respecting explicit order if given.
    `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.
    `boolean` | `isPrototype(String name)`
    `boolean` | `isRunning()` Check whether this component is currently running.
    `boolean` | `isSingleton(String name)`
    `boolean` | `isTypeMatch(String name, Class<?> typeToMatch)`
    `boolean` | `isTypeMatch(String name, org.springframework.core.ResolvableType typeToMatch)`
    `protected org.springframework.beans.factory.config.ConfigurableListableBeanFactory` | `obtainFreshBeanFactory()` Tell the subclass to refresh the internal bean factory.
    `protected void` | `onClose()` Template method which can be overridden to add context-specific shutdown work.
    `protected void` | `onRefresh()` Template method which can be overridden to add context-specific refresh work.
    `protected void` | `postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)` Modify the application context's internal bean factory after its standard initialization.
    `protected void` | `prepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)` 为我们的bean工厂填充内部属性
    `protected void` | `prepareRefresh()` Prepare this context for refreshing, setting its startup date and active flag as well as performing any initialization of property sources.
    `void` | `publishEvent(ApplicationEvent event)` Publish the given event to all listeners.
    `void` | `publishEvent(Object event)` Publish the given event to all listeners.
    `protected void` | `publishEvent(Object event, org.springframework.core.ResolvableType eventType)` Publish the given event to all listeners.
    `void` | `refresh()` Load or refresh the persistent representation of the configuration, which might an XML file, properties file, or relational database schema.
    `protected abstract void` | `refreshBeanFactory()` Subclasses must implement this method to perform the actual configuration load.
    `protected void` | `registerBeanPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)` Instantiate and register all BeanPostProcessor beans, respecting explicit order if given.
    `protected void` | `registerListeners()` Add beans that implement ApplicationListener as listeners.
    `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.
    `protected void` | `resetCommonCaches()` Reset Spring's common reflection metadata caches, in particular the `ReflectionUtils`, `AnnotationUtils`, `ResolvableType` and `CachedIntrospectionResults` caches.
    `void` | `setDisplayName(String displayName)` Set a friendly name for this context.
    `void` | `setEnvironment(org.springframework.core.env.ConfigurableEnvironment environment)` Set the `Environment` for this application context.
    `void` | `setId(String id)` Set the unique id of this application context.
    `void` | `setParent(ApplicationContext parent)` Set the parent of this application context.
    `void` | `start()` Start this component.
    `void` | `stop()` Stop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method.
    `String` | `toString()` Return information about this context.

    - ### 从类继承的方法 org.springframework.core.io.DefaultResourceLoader

      `addProtocolResolver, clearResourceCaches, getClassLoader, getProtocolResolvers, getResource, getResourceByPath, getResourceCache, setClassLoader`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### 从接口继承的方法 org.springframework.context.ConfigurableApplicationContext

      `addProtocolResolver`

    - ### 从接口继承的方法 org.springframework.core.io.ResourceLoader

      `getClassLoader, getResource`

- - ### 字段详细资料

    - #### MESSAGE_SOURCE_BEAN_NAME

          public static final String MESSAGE_SOURCE_BEAN_NAME

      Name of the MessageSource bean in the factory. If none is supplied, message resolution is delegated to the parent.
      另请参阅:
        `MessageSource`, 常量字段值

    - #### LIFECYCLE_PROCESSOR_BEAN_NAME

          public static final String LIFECYCLE_PROCESSOR_BEAN_NAME

      Name of the LifecycleProcessor bean in the factory. If none is supplied, a DefaultLifecycleProcessor is used.
      另请参阅:
        `LifecycleProcessor`, `DefaultLifecycleProcessor`, 常量字段值

    - #### APPLICATION_EVENT_MULTICASTER_BEAN_NAME

          public static final String APPLICATION_EVENT_MULTICASTER_BEAN_NAME

      Name of the ApplicationEventMulticaster bean in the factory. If none is supplied, a default SimpleApplicationEventMulticaster is used.
      另请参阅:
        `ApplicationEventMulticaster`, `SimpleApplicationEventMulticaster`, 常量字段值

    - #### logger

          protected final Log logger

      Logger used by this class. Available to subclasses.

  - ### 构造器详细资料

    - #### AbstractApplicationContext

          public AbstractApplicationContext()

      Create a new AbstractApplicationContext with no parent.

    - #### AbstractApplicationContext

          public AbstractApplicationContext(@Nullable
                                            ApplicationContext parent)

      Create a new AbstractApplicationContext with the given parent context.
      参数:
        `parent` - the parent context

  - ### 方法详细资料

    - #### setId

          public void setId(String id)

      Set the unique id of this application context.

      Default is the object id of the context instance, or the name of the context bean if the context is itself defined as a bean.

      指定者:
        `setId` 在接口中 `ConfigurableApplicationContext`
      参数:
        `id` - the unique id of the context

    - #### getId

          public String getId()

      从接口复制的说明: `ApplicationContext`
      Return the unique id of this application context.
      指定者:
        `getId` 在接口中 `ApplicationContext`
      返回:
        the unique id of the context, or `null` if none

    - #### getApplicationName

          public String getApplicationName()

      从接口复制的说明: `ApplicationContext`
      Return a name for the deployed application that this context belongs to.
      指定者:
        `getApplicationName` 在接口中 `ApplicationContext`
      返回:
        a name for the deployed application, or the empty String by default

    - #### setDisplayName

          public void setDisplayName(String displayName)

      Set a friendly name for this context. Typically done during initialization of concrete context implementations.

      Default is the object id of the context instance.

    - #### getDisplayName

          public String getDisplayName()

      Return a friendly name for this context.
      指定者:
        `getDisplayName` 在接口中 `ApplicationContext`
      返回:
        a display name for this context (never `null`)

    - #### getParent

          @Nullable
          public ApplicationContext getParent()

      Return the parent context, or `null` if there is no parent (that is, this context is the root of the context hierarchy).
      指定者:
        `getParent` 在接口中 `ApplicationContext`
      返回:
        the parent context, or `null` if there is no parent

    - #### setEnvironment

          public void setEnvironment(org.springframework.core.env.ConfigurableEnvironment environment)

      Set the `Environment` for this application context.

      Default value is determined by `createEnvironment()`. Replacing the default with this method is one option but configuration through `getEnvironment()` should also be considered. In either case, such modifications should be performed before `refresh()`.

      指定者:
        `setEnvironment` 在接口中 `ConfigurableApplicationContext`
      参数:
        `environment` - the new environment
      另请参阅:
        `createEnvironment()`

    - #### getEnvironment

          public org.springframework.core.env.ConfigurableEnvironment getEnvironment()

      Return the `Environment` for this application context in configurable form, allowing for further customization.

      If none specified, a default environment will be initialized via `createEnvironment()`.

      指定者:
        `getEnvironment` 在接口中 `ConfigurableApplicationContext`
      指定者:
        `getEnvironment` 在接口中 `org.springframework.core.env.EnvironmentCapable`

    - #### createEnvironment

          protected org.springframework.core.env.ConfigurableEnvironment createEnvironment()

      Create and return a new `StandardEnvironment`.

      Subclasses may override this method in order to supply a custom `ConfigurableEnvironment` implementation.

    - #### getAutowireCapableBeanFactory

          public org.springframework.beans.factory.config.AutowireCapableBeanFactory getAutowireCapableBeanFactory()
                                                                                                            throws IllegalStateException

      Return this context's internal bean factory as AutowireCapableBeanFactory, if already available.
      指定者:
        `getAutowireCapableBeanFactory` 在接口中 `ApplicationContext`
      返回:
        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
      另请参阅:
        `getBeanFactory()`

    - #### getStartupDate

          public long getStartupDate()

      Return the timestamp (ms) when this context was first loaded.
      指定者:
        `getStartupDate` 在接口中 `ApplicationContext`
      返回:
        the timestamp (ms) when this context was first loaded

    - #### publishEvent

          public void publishEvent(ApplicationEvent event)

      Publish the given event to all listeners.

      Note: Listeners get initialized after the MessageSource, to be able to access it within listener implementations. Thus, MessageSource implementations cannot publish events.

      指定者:
        `publishEvent` 在接口中 `ApplicationEventPublisher`
      参数:
        `event` - the event to publish (may be application-specific or a standard framework event)
      另请参阅:
        `org.springframework.web.context.support.RequestHandledEvent`

    - #### publishEvent

          public void publishEvent(Object event)

      Publish the given event to all listeners.

      Note: Listeners get initialized after the MessageSource, to be able to access it within listener implementations. Thus, MessageSource implementations cannot publish events.

      指定者:
        `publishEvent` 在接口中 `ApplicationEventPublisher`
      参数:
        `event` - the event to publish (may be an `ApplicationEvent` or a payload object to be turned into a `PayloadApplicationEvent`)
      另请参阅:
        `PayloadApplicationEvent`

    - #### publishEvent

          protected void publishEvent(Object event,
                                      @Nullable
                                      org.springframework.core.ResolvableType eventType)

      Publish the given event to all listeners.
      参数:
        `event` - the event to publish (may be an `ApplicationEvent` or a payload object to be turned into a `PayloadApplicationEvent`)
        `eventType` - the resolved event type, if known
      从以下版本开始:
        4.2

    - #### getResourcePatternResolver

          protected org.springframework.core.io.support.ResourcePatternResolver getResourcePatternResolver()

      Return the ResourcePatternResolver to use for resolving location patterns into Resource instances. Default is a `PathMatchingResourcePatternResolver`, supporting Ant-style location patterns.

      Can be overridden in subclasses, for extended resolution strategies, for example in a web environment.

      Do not call this when needing to resolve a location pattern. Call the context's `getResources` method instead, which will delegate to the ResourcePatternResolver.

      返回:
        the ResourcePatternResolver for this context
      另请参阅:
        `getResources(java.lang.String)`, `PathMatchingResourcePatternResolver`

    - #### setParent

          public void setParent(@Nullable
                                ApplicationContext parent)

      Set the parent of this application context.

      The parent environment is merged with this (child) application context environment if the parent is non-`null` and its environment is an instance of `ConfigurableEnvironment`.

      指定者:
        `setParent` 在接口中 `ConfigurableApplicationContext`
      参数:
        `parent` - the parent context
      另请参阅:
        `ConfigurableEnvironment.merge(ConfigurableEnvironment)`

    - #### addBeanFactoryPostProcessor

          public void addBeanFactoryPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor postProcessor)

      从接口复制的说明: `ConfigurableApplicationContext`
      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.
      指定者:
        `addBeanFactoryPostProcessor` 在接口中 `ConfigurableApplicationContext`
      参数:
        `postProcessor` - the factory processor to register

    - #### getBeanFactoryPostProcessors

          public List<org.springframework.beans.factory.config.BeanFactoryPostProcessor> getBeanFactoryPostProcessors()

      Return the list of BeanFactoryPostProcessors that will get applied to the internal BeanFactory.

    - #### addApplicationListener

          public void addApplicationListener(ApplicationListener<?> listener)

      从接口复制的说明: `ConfigurableApplicationContext`
      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.

      指定者:
        `addApplicationListener` 在接口中 `ConfigurableApplicationContext`
      参数:
        `listener` - the ApplicationListener to register
      另请参阅:
        `ContextRefreshedEvent`, `ContextClosedEvent`

    - #### getApplicationListeners

          public Collection<ApplicationListener<?>> getApplicationListeners()

      IOC 容器的刷新

    - #### refresh

          public void refresh()
                       throws org.springframework.beans.BeansException,
                              IllegalStateException

      从接口复制的说明: `ConfigurableApplicationContext`
      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.

      指定者:
        `refresh` 在接口中 `ConfigurableApplicationContext`
      抛出:
        `org.springframework.beans.BeansException` - if the bean factory could not be initialized
        `IllegalStateException` - if already initialized and multiple refresh attempts are not supported

    - #### prepareRefresh

          protected void prepareRefresh()

      Prepare this context for refreshing, setting its startup date and active flag as well as performing any initialization of property sources.

    - #### initPropertySources

          protected void initPropertySources()

      Replace any stub property sources with actual instances.

      另请参阅:
        `PropertySource.StubPropertySource`

    - #### obtainFreshBeanFactory

          protected org.springframework.beans.factory.config.ConfigurableListableBeanFactory obtainFreshBeanFactory()

      Tell the subclass to refresh the internal bean factory.
      返回:
        the fresh BeanFactory instance
      另请参阅:
        `refreshBeanFactory()`, `getBeanFactory()`

    - #### prepareBeanFactory

          protected void prepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

      为我们的bean工厂填充内部属性
      参数:
        `beanFactory` - the BeanFactory to configure

    - #### postProcessBeanFactory

          protected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

      Modify the application context's internal bean factory after its standard initialization. All bean definitions will have been loaded, but no beans will have been instantiated yet. This allows for registering special BeanPostProcessors etc in certain ApplicationContext implementations.
      参数:
        `beanFactory` - the bean factory used by the application context

    - #### invokeBeanFactoryPostProcessors

          protected void invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

      Instantiate and invoke all registered BeanFactoryPostProcessor beans, respecting explicit order if given.

      Must be called before singleton instantiation.

    - #### registerBeanPostProcessors

          protected void registerBeanPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

      Instantiate and register all BeanPostProcessor beans, respecting explicit order if given.

      Must be called before any instantiation of application beans.

    - #### initMessageSource

          protected void initMessageSource()

      Initialize the MessageSource. Use parent's if none defined in this context.

    - #### initApplicationEventMulticaster

          protected void initApplicationEventMulticaster()

      从bean工厂中获取或者直接显示的new一个多播器赋值给我们的applicatoinContext对象 采用典型的设计模式就是观察者模式 多播器作为的是一个被观察者
      另请参阅:
        `SimpleApplicationEventMulticaster`

    - #### initLifecycleProcessor

          protected void initLifecycleProcessor()

      Initialize the LifecycleProcessor. Uses DefaultLifecycleProcessor if none defined in the context.
      另请参阅:
        `DefaultLifecycleProcessor`

    - #### onRefresh

          protected void onRefresh()
                            throws org.springframework.beans.BeansException

      Template method which can be overridden to add context-specific refresh work. Called on initialization of special beans, before instantiation of singletons.

      This implementation is empty.

      抛出:
        `org.springframework.beans.BeansException` - in case of errors
      另请参阅:
        `refresh()`

    - #### registerListeners

          protected void registerListeners()

      Add beans that implement ApplicationListener as listeners. Doesn't affect other listeners, which can be added without being beans.

    - #### finishBeanFactoryInitialization

          protected void finishBeanFactoryInitialization(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

      Finish the initialization of this context's bean factory, initializing all remaining singleton beans.

    - #### finishRefresh

          protected void finishRefresh()

      Finish the refresh of this context, invoking the LifecycleProcessor's onRefresh() method and publishing the `ContextRefreshedEvent`.

    - #### cancelRefresh

          protected void cancelRefresh(org.springframework.beans.BeansException ex)

      Cancel this context's refresh attempt, resetting the `active` flag after an exception got thrown.
      参数:
        `ex` - the exception that led to the cancellation

    - #### resetCommonCaches

          protected void resetCommonCaches()

      Reset Spring's common reflection metadata caches, in particular the `ReflectionUtils`, `AnnotationUtils`, `ResolvableType` and `CachedIntrospectionResults` caches.
      从以下版本开始:
        4.2
      另请参阅:
        `ReflectionUtils.clearCache()`, `AnnotationUtils.clearCache()`, `ResolvableType.clearCache()`, `CachedIntrospectionResults.clearClassLoader(ClassLoader)`

    - #### registerShutdownHook

          public 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.

      Delegates to `doClose()` for the actual closing procedure.

      指定者:
        `registerShutdownHook` 在接口中 `ConfigurableApplicationContext`
      另请参阅:
        `Runtime.addShutdownHook(java.lang.Thread)`, `close()`, `doClose()`

    - #### destroy

          @Deprecated
          public void destroy()

      已过时。 as of Spring Framework 5.0, in favor of `close()`
      Callback for destruction of this instance, originally attached to a `DisposableBean` implementation (not anymore in 5.0).

      The `close()` method is the native way to shut down an ApplicationContext, which this method simply delegates to.

    - #### close

          public void close()

      Close this application context, destroying all beans in its bean factory.

      Delegates to `doClose()` for the actual closing procedure. Also removes a JVM shutdown hook, if registered, as it's not needed anymore.

      指定者:
        `close` 在接口中 `Closeable`
      指定者:
        `close` 在接口中 `AutoCloseable`
      指定者:
        `close` 在接口中 `ConfigurableApplicationContext`
      另请参阅:
        `doClose()`, `registerShutdownHook()`

    - #### doClose

          protected void doClose()

      Actually performs context closing: publishes a ContextClosedEvent and destroys the singletons in the bean factory of this application context.

      Called by both `close()` and a JVM shutdown hook, if any.

      另请参阅:
        `ContextClosedEvent`, `destroyBeans()`, `close()`, `registerShutdownHook()`

    - #### destroyBeans

          protected void destroyBeans()

      Template method for destroying all beans that this context manages. The default implementation destroy all cached singletons in this context, invoking `DisposableBean.destroy()` and/or the specified "destroy-method".

      Can be overridden to add context-specific bean destruction steps right before or right after standard singleton destruction, while the context's BeanFactory is still active.

      另请参阅:
        `getBeanFactory()`, `ConfigurableBeanFactory.destroySingletons()`

    - #### onClose

          protected void onClose()

      Template method which can be overridden to add context-specific shutdown work. The default implementation is empty.

      Called at the end of `doClose()`'s shutdown procedure, after this context's BeanFactory has been closed. If custom shutdown logic needs to execute while the BeanFactory is still active, override the `destroyBeans()` method instead.

    - #### isActive

          public boolean isActive()

      从接口复制的说明: `ConfigurableApplicationContext`
      Determine whether this application context is active, that is, whether it has been refreshed at least once and has not been closed yet.
      指定者:
        `isActive` 在接口中 `ConfigurableApplicationContext`
      返回:
        whether the context is still active
      另请参阅:
        `ConfigurableApplicationContext.refresh()`, `ConfigurableApplicationContext.close()`, `ConfigurableApplicationContext.getBeanFactory()`

    - #### assertBeanFactoryActive

          protected void assertBeanFactoryActive()

      Assert that this context's BeanFactory is currently active, throwing an `IllegalStateException` if it isn't.

      Invoked by all `BeanFactory` delegation methods that depend on an active context, i.e. in particular all bean accessor methods.

      The default implementation checks the `'active'` status of this context overall. May be overridden for more specific checks, or for a no-op if `getBeanFactory()` itself throws an exception in such a case.

    - #### getBean

          public Object getBean(String name)
                         throws org.springframework.beans.BeansException

      指定者:
        `getBean` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### getBean

          public <T> T getBean(String name,
                               @Nullable
                               Class<T> requiredType)
                        throws org.springframework.beans.BeansException

      指定者:
        `getBean` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### getBean

          public Object getBean(String name,
                                Object... args)
                         throws org.springframework.beans.BeansException

      指定者:
        `getBean` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### getBean

          public <T> T getBean(Class<T> requiredType)
                        throws org.springframework.beans.BeansException

      指定者:
        `getBean` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### getBean

          public <T> T getBean(Class<T> requiredType,
                               Object... args)
                        throws org.springframework.beans.BeansException

      指定者:
        `getBean` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### containsBean

          public boolean containsBean(String name)

      指定者:
        `containsBean` 在接口中 `org.springframework.beans.factory.BeanFactory`

    - #### isSingleton

          public boolean isSingleton(String name)
                              throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `isSingleton` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### isPrototype

          public boolean isPrototype(String name)
                              throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `isPrototype` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### isTypeMatch

          public boolean isTypeMatch(String name,
                                     org.springframework.core.ResolvableType typeToMatch)
                              throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `isTypeMatch` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### isTypeMatch

          public boolean isTypeMatch(String name,
                                     @Nullable
                                     Class<?> typeToMatch)
                              throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `isTypeMatch` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### getType

          @Nullable
          public Class<?> getType(String name)
                                      throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `getType` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### getAliases

          public String[] getAliases(String name)

      指定者:
        `getAliases` 在接口中 `org.springframework.beans.factory.BeanFactory`

    - #### containsBeanDefinition

          public boolean containsBeanDefinition(String beanName)

      指定者:
        `containsBeanDefinition` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`

    - #### getBeanDefinitionCount

          public int getBeanDefinitionCount()

      指定者:
        `getBeanDefinitionCount` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`

    - #### getBeanDefinitionNames

          public String[] getBeanDefinitionNames()

      指定者:
        `getBeanDefinitionNames` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`

    - #### getBeanNamesForType

          public String[] getBeanNamesForType(org.springframework.core.ResolvableType type)

      指定者:
        `getBeanNamesForType` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`

    - #### getBeanNamesForType

          public String[] getBeanNamesForType(@Nullable
                                              Class<?> type)

      指定者:
        `getBeanNamesForType` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`

    - #### getBeanNamesForType

          public String[] getBeanNamesForType(@Nullable
                                              Class<?> type,
                                              boolean includeNonSingletons,
                                              boolean allowEagerInit)

      指定者:
        `getBeanNamesForType` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`

    - #### getBeansOfType

          public <T> Map<String,T> getBeansOfType(@Nullable
                                                  Class<T> type)
                                           throws org.springframework.beans.BeansException

      指定者:
        `getBeansOfType` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### getBeansOfType

          public <T> Map<String,T> getBeansOfType(@Nullable
                                                  Class<T> type,
                                                  boolean includeNonSingletons,
                                                  boolean allowEagerInit)
                                           throws org.springframework.beans.BeansException

      指定者:
        `getBeansOfType` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### getBeanNamesForAnnotation

          public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType)

      指定者:
        `getBeanNamesForAnnotation` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`

    - #### getBeansWithAnnotation

          public Map<String,Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType)
                                                    throws org.springframework.beans.BeansException

      指定者:
        `getBeansWithAnnotation` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### findAnnotationOnBean

          @Nullable
          public <A extends Annotation> A findAnnotationOnBean(String beanName,
                                                                          Class<A> annotationType)
                                                                   throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `findAnnotationOnBean` 在接口中 `org.springframework.beans.factory.ListableBeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### getParentBeanFactory

          @Nullable
          public org.springframework.beans.factory.BeanFactory getParentBeanFactory()

      指定者:
        `getParentBeanFactory` 在接口中 `org.springframework.beans.factory.HierarchicalBeanFactory`

    - #### containsLocalBean

          public boolean containsLocalBean(String name)

      指定者:
        `containsLocalBean` 在接口中 `org.springframework.beans.factory.HierarchicalBeanFactory`

    - #### getInternalParentBeanFactory

          @Nullable
          protected org.springframework.beans.factory.BeanFactory getInternalParentBeanFactory()

      方法实现说明:获取我们spring上下文对象的父上下文，然后通过父上下文获取父工厂 Spring 根的上下文对象不会有父容器，但是我们的springmvc就在这里存在父工厂.

    - #### getMessage

          public String getMessage(String code,
                                   @Nullable
                                   Object[] args,
                                   @Nullable
                                   String defaultMessage,
                                   Locale locale)

      从接口复制的说明: `MessageSource`
      Try to resolve the message. Return default message if no message was found.
      指定者:
        `getMessage` 在接口中 `MessageSource`
      参数:
        `code` - the code to lookup up, such as 'calculator.noRateSet'. Users of this class are encouraged to base message names on the relevant fully qualified class name, thus avoiding conflict and ensuring maximum clarity.
        `args` - an array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), or `null` if none.
        `defaultMessage` - a default message to return if the lookup fails
        `locale` - the locale in which to do the lookup
      返回:
        the resolved message if the lookup was successful; otherwise the default message passed as a parameter
      另请参阅:
        `MessageFormat`

    - #### getMessage

          public String getMessage(String code,
                                   @Nullable
                                   Object[] args,
                                   Locale locale)
                            throws NoSuchMessageException

      从接口复制的说明: `MessageSource`
      Try to resolve the message. Treat as an error if the message can't be found.
      指定者:
        `getMessage` 在接口中 `MessageSource`
      参数:
        `code` - the code to lookup up, such as 'calculator.noRateSet'
        `args` - an array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), or `null` if none.
        `locale` - the locale in which to do the lookup
      返回:
        the resolved message
      抛出:
        `NoSuchMessageException` - if the message wasn't found
      另请参阅:
        `MessageFormat`

    - #### getMessage

          public String getMessage(MessageSourceResolvable resolvable,
                                   Locale locale)
                            throws NoSuchMessageException

      从接口复制的说明: `MessageSource`
      Try to resolve the message using all the attributes contained within the `MessageSourceResolvable` argument that was passed in.

      NOTE: We must throw a `NoSuchMessageException` on this method since at the time of calling this method we aren't able to determine if the `defaultMessage` property of the resolvable is `null` or not.

      指定者:
        `getMessage` 在接口中 `MessageSource`
      参数:
        `resolvable` - the value object storing attributes required to resolve a message
        `locale` - the locale in which to do the lookup
      返回:
        the resolved message
      抛出:
        `NoSuchMessageException` - if the message wasn't found
      另请参阅:
        `MessageFormat`

    - #### getInternalParentMessageSource

          @Nullable
          protected MessageSource getInternalParentMessageSource()

      Return the internal message source of the parent context if it is an AbstractApplicationContext too; else, return the parent context itself.

    - #### getResources

          public org.springframework.core.io.Resource[] getResources(String locationPattern)
                                                              throws IOException

      指定者:
        `getResources` 在接口中 `org.springframework.core.io.support.ResourcePatternResolver`
      抛出:
        `IOException`

    - #### start

          public void start()

      从接口复制的说明: `Lifecycle`
      Start this component.

      Should not throw an exception if the component is already running.

      In the case of a container, this will propagate the start signal to all components that apply.

      指定者:
        `start` 在接口中 `Lifecycle`
      另请参阅:
        `SmartLifecycle.isAutoStartup()`

    - #### stop

          public void stop()

      从接口复制的说明: `Lifecycle`
      Stop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method. Consider implementing `SmartLifecycle` and its `stop(Runnable)` variant when asynchronous stop behavior is necessary.

      Note that this stop notification is not guaranteed to come before destruction: On regular shutdown, `Lifecycle` beans will first receive a stop notification before the general destruction callbacks are being propagated; however, on hot refresh during a context's lifetime or on aborted refresh attempts, a given bean's destroy method will be called without any consideration of stop signals upfront.

      Should not throw an exception if the component is not running (not started yet).

      In the case of a container, this will propagate the stop signal to all components that apply.

      指定者:
        `stop` 在接口中 `Lifecycle`
      另请参阅:
        `SmartLifecycle.stop(Runnable)`, `DisposableBean.destroy()`

    - #### isRunning

          public boolean isRunning()

      从接口复制的说明: `Lifecycle`
      Check whether this component is currently running.

      In the case of a container, this will return `true` only if all components that apply are currently running.

      指定者:
        `isRunning` 在接口中 `Lifecycle`
      返回:
        whether the component is currently running

    - #### refreshBeanFactory

          protected abstract void refreshBeanFactory()
                                              throws org.springframework.beans.BeansException,
                                                     IllegalStateException

      Subclasses must implement this method to perform the actual configuration load. The method is invoked by `refresh()` before any other initialization work.

      A subclass will either create a new bean factory and hold a reference to it, or return a single BeanFactory instance that it holds. In the latter case, it will usually throw an IllegalStateException if refreshing the context more than once.

      抛出:
        `org.springframework.beans.BeansException` - if initialization of the bean factory failed
        `IllegalStateException` - if already initialized and multiple refresh attempts are not supported

    - #### closeBeanFactory

          protected abstract void closeBeanFactory()

      Subclasses must implement this method to release their internal bean factory. This method gets invoked by `close()` after all other shutdown work.

      Should never throw an exception but rather log shutdown failures.

    - #### getBeanFactory

          public abstract org.springframework.beans.factory.config.ConfigurableListableBeanFactory getBeanFactory()
                                                                                                           throws IllegalStateException

      Subclasses must return their internal bean factory here. They should implement the lookup efficiently, so that it can be called repeatedly without a performance penalty.

      Note: Subclasses should check whether the context is still active before returning the internal bean factory. The internal factory should generally be considered unavailable once the context has been closed.

      指定者:
        `getBeanFactory` 在接口中 `ConfigurableApplicationContext`
      返回:
        this application context's internal bean factory (never `null`)
      抛出:
        `IllegalStateException` - if the context does not hold an internal bean factory yet (usually if `refresh()` has never been called) or if the context has been closed already
      另请参阅:
        `refreshBeanFactory()`, `closeBeanFactory()`

    - #### toString

          public String toString()

      Return information about this context.
      覆盖:
        `toString` 在类中 `Object`