org.springframework.scheduling.annotation

## 类 ScheduledAnnotationBeanPostProcessor

- java.lang.Object
- - org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor

- 所有已实现的接口:
    EventListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.SmartInitializingSingleton, org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor, ApplicationContextAware, ApplicationListener<ContextRefreshedEvent>, EmbeddedValueResolverAware, org.springframework.core.Ordered, ScheduledTaskHolder

      public class ScheduledAnnotationBeanPostProcessor
      extends Object
      implements ScheduledTaskHolder, org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor, org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor, org.springframework.core.Ordered, EmbeddedValueResolverAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.BeanFactoryAware, ApplicationContextAware, org.springframework.beans.factory.SmartInitializingSingleton, ApplicationListener<ContextRefreshedEvent>, org.springframework.beans.factory.DisposableBean

  Bean post-processor that registers methods annotated with @`Scheduled` to be invoked by a `TaskScheduler` according to the "fixedRate", "fixedDelay", or "cron" expression provided via the annotation.

  This post-processor is automatically registered by Spring's `<task:annotation-driven>` XML element, and also by the `@EnableScheduling` annotation.

  Autodetects any `SchedulingConfigurer` instances in the container, allowing for customization of the scheduler to be used or for fine-grained control over task registration (e.g. registration of `Trigger` tasks. See the @`EnableScheduling` javadocs for complete usage details.

  从以下版本开始:
    3.0
  作者:
    Mark Fisher, Juergen Hoeller, Chris Beams, Elizabeth Chatman
  另请参阅:
    `Scheduled`, `EnableScheduling`, `SchedulingConfigurer`, `TaskScheduler`, `ScheduledTaskRegistrar`, `AsyncAnnotationBeanPostProcessor`

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static String` | `DEFAULT_TASK_SCHEDULER_BEAN_NAME` The default name of the `TaskScheduler` bean to pick up: "taskScheduler".
    `protected Log` | `logger`

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

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### 构造器概要

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

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `afterSingletonsInstantiated()`
    `void` | `destroy()`
    `int` | `getOrder()`
    `Set<ScheduledTask>` | `getScheduledTasks()` Return all currently scheduled tasks, from `Scheduled` methods as well as from programmatic `SchedulingConfigurer` interaction.
    `void` | `onApplicationEvent(ContextRefreshedEvent event)` Handle an application event.
    `Object` | `postProcessAfterInitialization(Object bean, String beanName)`
    `void` | `postProcessBeforeDestruction(Object bean, String beanName)`
    `Object` | `postProcessBeforeInitialization(Object bean, String beanName)`
    `void` | `postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition, Class<?> beanType, String beanName)`
    `protected void` | `processScheduled(Scheduled scheduled, Method method, Object bean)` Process the given `@Scheduled` method declaration on the given bean.
    `boolean` | `requiresDestruction(Object bean)`
    `void` | `setApplicationContext(ApplicationContext applicationContext)` Setting an `ApplicationContext` is optional: If set, registered tasks will be activated in the `ContextRefreshedEvent` phase; if not set, it will happen at `afterSingletonsInstantiated()` time.
    `void` | `setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)` Making a `BeanFactory` available is optional; if not set, `SchedulingConfigurer` beans won't get autodetected and a `scheduler` has to be explicitly configured.
    `void` | `setBeanName(String beanName)`
    `void` | `setEmbeddedValueResolver(org.springframework.util.StringValueResolver resolver)` Set the StringValueResolver to use for resolving embedded definition values.
    `void` | `setScheduler(Object scheduler)` Set the `TaskScheduler` that will invoke the scheduled methods, or a `ScheduledExecutorService` to be wrapped as a TaskScheduler.

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

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

- - ### 字段详细资料

    - #### DEFAULT_TASK_SCHEDULER_BEAN_NAME

          public static final String DEFAULT_TASK_SCHEDULER_BEAN_NAME

      The default name of the `TaskScheduler` bean to pick up: "taskScheduler".

      Note that the initial lookup happens by type; this is just the fallback in case of multiple scheduler beans found in the context.

      从以下版本开始:
        4.2
      另请参阅:
        常量字段值

    - #### logger

          protected final Log logger

  - ### 构造器详细资料

    - #### ScheduledAnnotationBeanPostProcessor

          public ScheduledAnnotationBeanPostProcessor()

  - ### 方法详细资料

    - #### getOrder

          public int getOrder()

      指定者:
        `getOrder` 在接口中 `org.springframework.core.Ordered`

    - #### setScheduler

          public void setScheduler(Object scheduler)

      Set the `TaskScheduler` that will invoke the scheduled methods, or a `ScheduledExecutorService` to be wrapped as a TaskScheduler.

      If not specified, default scheduler resolution will apply: searching for a unique `TaskScheduler` bean in the context, or for a `TaskScheduler` bean named "taskScheduler" otherwise; the same lookup will also be performed for a `ScheduledExecutorService` bean. If neither of the two is resolvable, a local single-threaded default scheduler will be created within the registrar.

      另请参阅:
        `DEFAULT_TASK_SCHEDULER_BEAN_NAME`

    - #### setEmbeddedValueResolver

          public void setEmbeddedValueResolver(org.springframework.util.StringValueResolver resolver)

      从接口复制的说明: `EmbeddedValueResolverAware`
      Set the StringValueResolver to use for resolving embedded definition values.
      指定者:
        `setEmbeddedValueResolver` 在接口中 `EmbeddedValueResolverAware`

    - #### setBeanName

          public void setBeanName(String beanName)

      指定者:
        `setBeanName` 在接口中 `org.springframework.beans.factory.BeanNameAware`

    - #### setBeanFactory

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

      Making a `BeanFactory` available is optional; if not set, `SchedulingConfigurer` beans won't get autodetected and a `scheduler` has to be explicitly configured.
      指定者:
        `setBeanFactory` 在接口中 `org.springframework.beans.factory.BeanFactoryAware`

    - #### setApplicationContext

          public void setApplicationContext(ApplicationContext applicationContext)

      Setting an `ApplicationContext` is optional: If set, registered tasks will be activated in the `ContextRefreshedEvent` phase; if not set, it will happen at `afterSingletonsInstantiated()` time.
      指定者:
        `setApplicationContext` 在接口中 `ApplicationContextAware`
      参数:
        `applicationContext` - the ApplicationContext object to be used by this object
      另请参阅:
        `BeanInitializationException`

    - #### afterSingletonsInstantiated

          public void afterSingletonsInstantiated()

      指定者:
        `afterSingletonsInstantiated` 在接口中 `org.springframework.beans.factory.SmartInitializingSingleton`

    - #### onApplicationEvent

          public void onApplicationEvent(ContextRefreshedEvent event)

      从接口复制的说明: `ApplicationListener`
      Handle an application event.
      指定者:
        `onApplicationEvent` 在接口中 `ApplicationListener<ContextRefreshedEvent>`
      参数:
        `event` - the event to respond to

    - #### postProcessMergedBeanDefinition

          public void postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition,
                                                      Class<?> beanType,
                                                      String beanName)

      指定者:
        `postProcessMergedBeanDefinition` 在接口中 `org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor`

    - #### postProcessBeforeInitialization

          public Object postProcessBeforeInitialization(Object bean,
                                                        String beanName)

      指定者:
        `postProcessBeforeInitialization` 在接口中 `org.springframework.beans.factory.config.BeanPostProcessor`

    - #### postProcessAfterInitialization

          public Object postProcessAfterInitialization(Object bean,
                                                       String beanName)

      指定者:
        `postProcessAfterInitialization` 在接口中 `org.springframework.beans.factory.config.BeanPostProcessor`

    - #### processScheduled

          protected void processScheduled(Scheduled scheduled,
                                          Method method,
                                          Object bean)

      Process the given `@Scheduled` method declaration on the given bean.
      参数:
        `scheduled` - the @Scheduled annotation
        `method` - the method that the annotation has been declared on
        `bean` - the target bean instance

    - #### getScheduledTasks

          public Set<ScheduledTask> getScheduledTasks()

      Return all currently scheduled tasks, from `Scheduled` methods as well as from programmatic `SchedulingConfigurer` interaction.
      指定者:
        `getScheduledTasks` 在接口中 `ScheduledTaskHolder`
      从以下版本开始:
        5.0.2

    - #### postProcessBeforeDestruction

          public void postProcessBeforeDestruction(Object bean,
                                                   String beanName)

      指定者:
        `postProcessBeforeDestruction` 在接口中 `org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor`

    - #### requiresDestruction

          public boolean requiresDestruction(Object bean)

      指定者:
        `requiresDestruction` 在接口中 `org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor`

    - #### destroy

          public void destroy()

      指定者:
        `destroy` 在接口中 `org.springframework.beans.factory.DisposableBean`