public class ScheduledAnnotationBeanPostProcessor extends java.lang.Object implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.core.Ordered, EmbeddedValueResolverAware, ApplicationContextAware, 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.
Auto-detects 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| Constructor and Description |
|---|
ScheduledAnnotationBeanPostProcessor() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
int |
getOrder() |
void |
onApplicationEvent(ContextRefreshedEvent event)
Handle an application event.
|
java.lang.Object |
postProcessAfterInitialization(java.lang.Object bean,
java.lang.String beanName) |
java.lang.Object |
postProcessBeforeInitialization(java.lang.Object bean,
java.lang.String beanName) |
protected void |
processScheduled(Scheduled scheduled,
java.lang.reflect.Method method,
java.lang.Object bean) |
void |
setApplicationContext(ApplicationContext applicationContext)
Set the ApplicationContext that this object runs in.
|
void |
setEmbeddedValueResolver(org.springframework.util.StringValueResolver resolver)
Set the StringValueResolver to use for resolving embedded definition values.
|
void |
setScheduler(java.lang.Object scheduler)
Set the
TaskScheduler that will invoke
the scheduled methods, or a ScheduledExecutorService
to be wrapped as a TaskScheduler. |
public ScheduledAnnotationBeanPostProcessor()
public int getOrder()
getOrder in interface org.springframework.core.Orderedpublic void setScheduler(java.lang.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 setApplicationContext(ApplicationContext applicationContext)
ApplicationContextAwareInvoked after population of normal bean properties but before an init callback such
as InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader),
ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) and
MessageSourceAware, if applicable.
setApplicationContext in interface ApplicationContextAwareapplicationContext - the ApplicationContext object to be used by this objectBeanInitializationExceptionpublic void onApplicationEvent(ContextRefreshedEvent event)
ApplicationListeneronApplicationEvent in interface ApplicationListener<ContextRefreshedEvent>event - the event to respond topublic java.lang.Object postProcessBeforeInitialization(java.lang.Object bean,
java.lang.String beanName)
postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessorpublic java.lang.Object postProcessAfterInitialization(java.lang.Object bean,
java.lang.String beanName)
postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessorprotected void processScheduled(Scheduled scheduled, java.lang.reflect.Method method, java.lang.Object bean)
public void destroy()
destroy in interface org.springframework.beans.factory.DisposableBean