public class ScheduledAnnotationBeanPostProcessor extends Object implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.core.Ordered, EmbeddedValueResolverAware, 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
Scheduled,
EnableScheduling,
SchedulingConfigurer,
TaskScheduler,
ScheduledTaskRegistrar| Constructor and Description |
|---|
ScheduledAnnotationBeanPostProcessor() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterSingletonsInstantiated() |
void |
destroy() |
int |
getOrder() |
void |
onApplicationEvent(ContextRefreshedEvent event)
Handle an application event.
|
Object |
postProcessAfterInitialization(Object bean,
String beanName) |
Object |
postProcessBeforeInitialization(Object bean,
String beanName) |
protected void |
processScheduled(Scheduled scheduled,
Method method,
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 |
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. |
protected final Log logger
public ScheduledAnnotationBeanPostProcessor()
public 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.public void setEmbeddedValueResolver(org.springframework.util.StringValueResolver resolver)
EmbeddedValueResolverAwaresetEmbeddedValueResolver in interface EmbeddedValueResolverAwarepublic 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 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.BeanPostProcessorpublic void destroy()
destroy in interface org.springframework.beans.factory.DisposableBean