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
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.
Scheduled, 
EnableScheduling, 
SchedulingConfigurer, 
TaskScheduler, 
ScheduledTaskRegistrar, 
AsyncAnnotationBeanPostProcessor| Modifier and Type | Field and Description | 
|---|---|
| static String | DEFAULT_TASK_SCHEDULER_BEAN_NAMEThe default name of the  TaskSchedulerbean to pick up: "taskScheduler". | 
| protected Log | logger | 
| Constructor and Description | 
|---|
| ScheduledAnnotationBeanPostProcessor()Create a default  ScheduledAnnotationBeanPostProcessor. | 
| ScheduledAnnotationBeanPostProcessor(ScheduledTaskRegistrar registrar)Create a  ScheduledAnnotationBeanPostProcessordelegating to the
 specifiedScheduledTaskRegistrar. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | afterSingletonsInstantiated() | 
| protected Runnable | createRunnable(Object target,
              Method method)Create a  Runnablefor the given bean instance,
 calling the specified scheduled method. | 
| void | destroy() | 
| int | getOrder() | 
| Set<ScheduledTask> | getScheduledTasks()Return all currently scheduled tasks, from  Scheduledmethods
 as well as from programmaticSchedulingConfigurerinteraction. | 
| 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  @Scheduledmethod declaration on the given bean. | 
| boolean | requiresDestruction(Object bean) | 
| void | setApplicationContext(ApplicationContext applicationContext)Setting an  ApplicationContextis optional: If set, registered
 tasks will be activated in theContextRefreshedEventphase;
 if not set, it will happen atafterSingletonsInstantiated()time. | 
| void | setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)Making a  BeanFactoryavailable is optional; if not set,SchedulingConfigurerbeans won't get autodetected and
 aschedulerhas 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  TaskSchedulerthat will invoke
 the scheduled methods, or aScheduledExecutorServiceto be wrapped as a TaskScheduler. | 
public static final String DEFAULT_TASK_SCHEDULER_BEAN_NAME
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.
protected final Log logger
public ScheduledAnnotationBeanPostProcessor()
ScheduledAnnotationBeanPostProcessor.public ScheduledAnnotationBeanPostProcessor(ScheduledTaskRegistrar registrar)
ScheduledAnnotationBeanPostProcessor delegating to the
 specified ScheduledTaskRegistrar.registrar - the ScheduledTaskRegistrar to register @Scheduled tasks onpublic int getOrder()
getOrder in interface org.springframework.core.Orderedpublic void setScheduler(Object scheduler)
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_NAMEpublic void setEmbeddedValueResolver(org.springframework.util.StringValueResolver resolver)
EmbeddedValueResolverAwaresetEmbeddedValueResolver in interface EmbeddedValueResolverAwarepublic void setBeanName(String beanName)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
BeanFactory available is optional; if not set,
 SchedulingConfigurer beans won't get autodetected and
 a scheduler has to be explicitly configured.setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwarepublic void setApplicationContext(ApplicationContext applicationContext)
ApplicationContext is optional: If set, registered
 tasks will be activated in the ContextRefreshedEvent phase;
 if not set, it will happen at afterSingletonsInstantiated() time.setApplicationContext in interface ApplicationContextAwareapplicationContext - the ApplicationContext object to be used by this objectBeanInitializationExceptionpublic void afterSingletonsInstantiated()
afterSingletonsInstantiated in interface org.springframework.beans.factory.SmartInitializingSingletonpublic void onApplicationEvent(ContextRefreshedEvent event)
ApplicationListeneronApplicationEvent in interface ApplicationListener<ContextRefreshedEvent>event - the event to respond topublic void postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition,
                                            Class<?> beanType,
                                            String beanName)
postProcessMergedBeanDefinition in interface org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessorpublic Object postProcessBeforeInitialization(Object bean, String beanName)
postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessorpublic Object postProcessAfterInitialization(Object bean, String beanName)
postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessorprotected void processScheduled(Scheduled scheduled, Method method, Object bean)
@Scheduled method declaration on the given bean.scheduled - the @Scheduled annotationmethod - the method that the annotation has been declared onbean - the target bean instancecreateRunnable(Object, Method)protected Runnable createRunnable(Object target, Method method)
Runnable for the given bean instance,
 calling the specified scheduled method.
 The default implementation creates a ScheduledMethodRunnable.
target - the target bean instancemethod - the scheduled method to callScheduledMethodRunnable.ScheduledMethodRunnable(Object, Method)public Set<ScheduledTask> getScheduledTasks()
Scheduled methods
 as well as from programmatic SchedulingConfigurer interaction.getScheduledTasks in interface ScheduledTaskHolderpublic void postProcessBeforeDestruction(Object bean, String beanName)
postProcessBeforeDestruction in interface org.springframework.beans.factory.config.DestructionAwareBeanPostProcessorpublic boolean requiresDestruction(Object bean)
requiresDestruction in interface org.springframework.beans.factory.config.DestructionAwareBeanPostProcessorpublic void destroy()
destroy in interface org.springframework.beans.factory.DisposableBean