org.springframework.context.support

## 类 DefaultLifecycleProcessor

- java.lang.Object
- - org.springframework.context.support.DefaultLifecycleProcessor

- 所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, Lifecycle, LifecycleProcessor

      public class DefaultLifecycleProcessor
      extends Object
      implements LifecycleProcessor, org.springframework.beans.factory.BeanFactoryAware

  Default implementation of the `LifecycleProcessor` strategy.
  从以下版本开始:
    3.0
  作者:
    Mark Fisher, Juergen Hoeller

- - ### 构造器概要

    构造器
    构造器和说明
    `DefaultLifecycleProcessor()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected Map<String,Lifecycle>` | `getLifecycleBeans()` Retrieve all applicable Lifecycle beans: all singletons that have already been created, as well as all SmartLifecycle beans (even if they are marked as lazy-init).
    `protected int` | `getPhase(Lifecycle bean)` Determine the lifecycle phase of the given bean.
    `boolean` | `isRunning()` Check whether this component is currently running.
    `void` | `onClose()` Notification of context close phase, e.g. for auto-stopping components.
    `void` | `onRefresh()` Notification of context refresh, e.g. for auto-starting components.
    `void` | `setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)`
    `void` | `setTimeoutPerShutdownPhase(long timeoutPerShutdownPhase)` Specify the maximum time allotted in milliseconds for the shutdown of any phase (group of SmartLifecycle beans with the same 'phase' value).
    `void` | `start()` Start all registered beans that implement `Lifecycle` and are not already running.
    `void` | `stop()` Stop all registered beans that implement `Lifecycle` and are currently running.

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

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

- - ### 构造器详细资料

    - #### DefaultLifecycleProcessor

          public DefaultLifecycleProcessor()

  - ### 方法详细资料

    - #### setTimeoutPerShutdownPhase

          public void setTimeoutPerShutdownPhase(long timeoutPerShutdownPhase)

      Specify the maximum time allotted in milliseconds for the shutdown of any phase (group of SmartLifecycle beans with the same 'phase' value).

      The default value is 30 seconds.

    - #### setBeanFactory

          public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)

      指定者:
        `setBeanFactory` 在接口中 `org.springframework.beans.factory.BeanFactoryAware`

    - #### start

          public void start()

      Start all registered beans that implement `Lifecycle` and are not already running. Any bean that implements `SmartLifecycle` will be started within its 'phase', and all phases will be ordered from lowest to highest value. All beans that do not implement `SmartLifecycle` will be started in the default phase 0. A bean declared as a dependency of another bean will be started before the dependent bean regardless of the declared phase.
      指定者:
        `start` 在接口中 `Lifecycle`
      另请参阅:
        `SmartLifecycle.isAutoStartup()`

    - #### stop

          public void stop()

      Stop all registered beans that implement `Lifecycle` and are currently running. Any bean that implements `SmartLifecycle` will be stopped within its 'phase', and all phases will be ordered from highest to lowest value. All beans that do not implement `SmartLifecycle` will be stopped in the default phase 0. A bean declared as dependent on another bean will be stopped before the dependency bean regardless of the declared phase.
      指定者:
        `stop` 在接口中 `Lifecycle`
      另请参阅:
        `SmartLifecycle.stop(Runnable)`, `DisposableBean.destroy()`

    - #### onRefresh

          public void onRefresh()

      从接口复制的说明: `LifecycleProcessor`
      Notification of context refresh, e.g. for auto-starting components.
      指定者:
        `onRefresh` 在接口中 `LifecycleProcessor`

    - #### onClose

          public void onClose()

      从接口复制的说明: `LifecycleProcessor`
      Notification of context close phase, e.g. for auto-stopping components.
      指定者:
        `onClose` 在接口中 `LifecycleProcessor`

    - #### 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

    - #### getLifecycleBeans

          protected Map<String,Lifecycle> getLifecycleBeans()

      Retrieve all applicable Lifecycle beans: all singletons that have already been created, as well as all SmartLifecycle beans (even if they are marked as lazy-init).
      返回:
        the Map of applicable beans, with bean names as keys and bean instances as values

    - #### getPhase

          protected int getPhase(Lifecycle bean)

      Determine the lifecycle phase of the given bean.

      The default implementation checks for the `Phased` interface, using a default of 0 otherwise. Can be overridden to apply other/further policies.

      参数:
        `bean` - the bean to introspect
      返回:
        the phase (an integer value)
      另请参阅:
        `Phased.getPhase()`, `SmartLifecycle`