@Scheduled to be invoked by a
org.springframework.scheduling.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, org.springframework.scheduling.TaskScheduler , org.springframework.scheduling.config.ScheduledTaskRegistrar , AsyncAnnotationBeanPostProcessor
| Modifier and Type | Field and Description |
|---|---|
| private ApplicationContext | |
| private BeanFactory | |
| private String | |
| public static final String | DEFAULT_TASK_SCHEDULER_BEAN_NAME
The default name of the |
| private StringValueResolver | |
| private TaskSchedulerRouter | |
| protected final Log | |
| private final Set | |
| private static final boolean | reactiveStreamsPresent
Reactive Streams API present on the classpath? |
| private final Map | |
| private final ScheduledTaskRegistrar | |
| private final Map | |
| private Object |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ScheduledAnnotationBeanPostProcessor(ScheduledTaskRegistrar
the ScheduledTaskRegistrar to register registrar)@Scheduled
tasks onCreate a |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterSingletonsInstantiated()
Implements org. Invoked right at the end of the singleton pre-instantiation phase, with a guarantee that all regular singleton beans have been created already. |
| protected Runnable | createRunnable(Object
the target bean instance target, Method the scheduled method to call method, String qualifier)Create a |
| protected Runnable | createRunnable(Object
the target bean instance target, Method the scheduled method to call method)
Deprecated
since 6.1. in favor of
createRunnable(Object, Method, String)
Create a |
| public void | destroy()
Implements org. Invoked by the containing |
| private void | |
| public int | |
| public Set | getScheduledTasks()
Implements org. Return all currently scheduled tasks, from |
| private static boolean | |
| private static boolean | |
| public void | onApplicationEvent(ApplicationContextEvent
the event to respond to event)Implements org. Reacts to |
| public Object | postProcessAfterInitialization(Object
the new bean instance bean, String the name of the bean beanName)Overrides default org. Apply this |
| public void | postProcessBeforeDestruction(Object
the bean instance to be destroyed bean, String the name of the bean beanName)Implements org. Apply this BeanPostProcessor to the given bean instance before its destruction, e.g. invoking custom destruction callbacks. |
| public Object | postProcessBeforeInitialization(Object
the new bean instance bean, String the name of the bean beanName)Overrides default org. Apply this |
| public void | postProcessMergedBeanDefinition(RootBeanDefinition
the merged bean definition for the bean beanDefinition, Class<?> the actual type of the managed bean instance beanType, String the name of the bean beanName)Implements org. Post-process the given merged bean definition for the specified bean. |
| protected void | processScheduled(Scheduled
the scheduled, Method @Scheduled annotationthe method that the annotation has been declared on method, Object the target bean instance bean)Process the given |
| private void | processScheduledAsync(Scheduled
the scheduled, Method @Scheduled annotationthe method that the annotation has been declared on, which
must either return a Publisher-adaptable type or be a Kotlin suspending function method, Object the target bean instance bean)Process the given |
| private void | processScheduledSync(Scheduled
the scheduled, Method @Scheduled annotationthe method that the annotation has been declared on method, Object the target bean instance bean)Process the given |
| private void | processScheduledTask(Scheduled
the scheduled, Runnable @Scheduled annotationthe runnable to be scheduled runnable, Method the method that the annotation has been declared on method, Object the target bean instance bean)Parse the |
| public boolean | requiresDestruction(Object
the bean instance to check bean)Overrides default org. Determine whether the given bean instance requires destruction by this post-processor. |
| public void | setApplicationContext(ApplicationContext
the ApplicationContext object to be used by this object applicationContext)Implements org. Setting an |
| public void | setBeanFactory(BeanFactory
owning BeanFactory (never beanFactory)null).
The bean can immediately call methods on the factory.Implements org. Making a |
| public void | setBeanName(String
the name of the bean in the factory.
Note that this name is the actual bean name used in the factory, which may
differ from the originally specified name: in particular for inner bean
names, the actual bean name might have been made unique through appending
"#..." suffixes. Use the beanName)BeanFactoryUtils#originalBeanName(String)
method to extract the original bean name (without suffix), if desired.Implements org. Set the name of the bean in the bean factory that created this bean. |
| public void | setEmbeddedValueResolver(StringValueResolver resolver)
Implements org. Set the StringValueResolver to use for resolving embedded definition values. |
| public void | setScheduler(Object scheduler)
Set the |
| private static Duration | |
| private static Duration |
| applicationContext | back to summary |
|---|---|
| private ApplicationContext applicationContext
| |
| beanFactory | back to summary |
|---|---|
| private BeanFactory beanFactory
| |
| beanName | back to summary |
|---|---|
| private String beanName
| |
| DEFAULT_TASK_SCHEDULER_BEAN_NAME | back to summary |
|---|---|
| public static final String DEFAULT_TASK_SCHEDULER_BEAN_NAME The default name of the Note that the initial lookup happens by type; this is just the fallback in case of multiple scheduler beans found in the context.
| |
| embeddedValueResolver | back to summary |
|---|---|
| private StringValueResolver embeddedValueResolver
| |
| localScheduler | back to summary |
|---|---|
| private TaskSchedulerRouter localScheduler
| |
| logger | back to summary |
|---|---|
| protected final Log logger | |
| nonAnnotatedClasses | back to summary |
|---|---|
| private final Set<Class<?>> nonAnnotatedClasses | |
| reactiveStreamsPresent | back to summary |
|---|---|
| private static final boolean reactiveStreamsPresent Reactive Streams API present on the classpath? | |
| reactiveSubscriptions | back to summary |
|---|---|
| private final Map<Object, List<Runnable>> reactiveSubscriptions | |
| registrar | back to summary |
|---|---|
| private final ScheduledTaskRegistrar registrar | |
| scheduledTasks | back to summary |
|---|---|
| private final Map<Object, Set<ScheduledTask>> scheduledTasks | |
| scheduler | back to summary |
|---|---|
| private Object scheduler
| |
| ScheduledAnnotationBeanPostProcessor | back to summary |
|---|---|
| public ScheduledAnnotationBeanPostProcessor() Create a default | |
| ScheduledAnnotationBeanPostProcessor | back to summary |
|---|---|
| public ScheduledAnnotationBeanPostProcessor(ScheduledTaskRegistrar registrar) Create a
| |
| afterSingletonsInstantiated | back to summary |
|---|---|
| public void afterSingletonsInstantiated() Implements org. Doc from org. Invoked right at the end of the singleton pre-instantiation phase,
with a guarantee that all regular singleton beans have been created
already. Note This callback won't be triggered for singleton beans
lazily initialized on demand after
| |
| createRunnable | back to summary |
|---|---|
| protected Runnable createRunnable(Object target, Method method, String qualifier) Create a The default implementation creates a
| |
| createRunnable | back to summary |
|---|---|
| protected Runnable createRunnable(Object target, Method method)
Create a
| |
| destroy | back to summary |
|---|---|
| public void destroy() Implements org. Doc from org. Invoked by the containing
| |
| finishRegistration | back to summary |
|---|---|
| private void finishRegistration() | |
| getOrder | back to summary |
|---|---|
| public int getOrder() Implements org. Doc from org. Get the order value of this object. Higher values are interpreted as lower priority. As a consequence,
the object with the lowest value has the highest priority (somewhat
analogous to Servlet Same order values will result in arbitrary sort positions for the affected objects.
| |
| getScheduledTasks | back to summary |
|---|---|
| public Set Implements org. Return all currently scheduled tasks, from Note that this includes upcoming scheduled subscriptions for reactive methods but doesn't cover any currently active subscription for such methods.
| |
| isDurationString | back to summary |
|---|---|
| private static boolean isDurationString(String value) | |
| isP | back to summary |
|---|---|
| private static boolean isP(char ch) | |
| onApplicationEvent | back to summary |
|---|---|
| public void onApplicationEvent(ApplicationContextEvent event) Implements org. Reacts to
| |
| postProcessAfterInitialization | back to summary |
|---|---|
| public Object postProcessAfterInitialization(Object bean, String beanName) Overrides default org. Doc from org. Apply this In case of a FactoryBean, this callback will be invoked for both the FactoryBean
instance and the objects created by the FactoryBean (as of Spring 2.0). The
post-processor can decide whether to apply to either the FactoryBean or created
objects or both through corresponding This callback will also be invoked after a short-circuiting triggered by a
The default implementation returns the given | |
| postProcessBeforeDestruction | back to summary |
|---|---|
| public void postProcessBeforeDestruction(Object bean, String beanName) Implements org. Apply this BeanPostProcessor to the given bean instance before its destruction, e.g. invoking custom destruction callbacks. Like DisposableBean's | |
| postProcessBeforeInitialization | back to summary |
|---|---|
| public Object postProcessBeforeInitialization(Object bean, String beanName) Overrides default org. Doc from org. Apply this The default implementation returns the given | |
| postProcessMergedBeanDefinition | back to summary |
|---|---|
| public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) Implements org. Post-process the given merged bean definition for the specified bean.
| |
| processScheduled | back to summary |
|---|---|
| protected void processScheduled(Scheduled scheduled, Method method, Object bean) Process the given | |
| processScheduledAsync | back to summary |
|---|---|
| private void processScheduledAsync(Scheduled scheduled, Method method, Object bean) Process the given Note that for fixed delay configuration, the subscription is turned into a blocking
call instead. Types for which a
| |
| processScheduledSync | back to summary |
|---|---|
| private void processScheduledSync(Scheduled scheduled, Method method, Object bean) Process the given | |
| processScheduledTask | back to summary |
|---|---|
| private void processScheduledTask(Scheduled scheduled, Runnable runnable, Method method, Object bean) Parse the | |
| requiresDestruction | back to summary |
|---|---|
| public boolean requiresDestruction(Object bean) Overrides default org. Doc from org. Determine whether the given bean instance requires destruction by this post-processor. The default implementation returns
| |
| setApplicationContext | back to summary |
|---|---|
| public void setApplicationContext(ApplicationContext applicationContext) Implements org. Setting an
| |
| setBeanFactory | back to summary |
|---|---|
| public void setBeanFactory(BeanFactory beanFactory) Implements org. Making a
| |
| setBeanName | back to summary |
|---|---|
| public void setBeanName(String beanName) Implements org. Doc from org. Set the name of the bean in the bean factory that created this bean. Invoked after population of normal bean properties but before an
init callback such as
| |
| setEmbeddedValueResolver | back to summary |
|---|---|
| public void setEmbeddedValueResolver(StringValueResolver resolver) Implements org. Doc from org. Set the StringValueResolver to use for resolving embedded definition values.
| |
| setScheduler | back to summary |
|---|---|
| public void setScheduler(Object scheduler) Set the If not specified, default scheduler resolution will apply: searching for a
unique
| |
| toDuration | back to summary |
|---|---|
| private static Duration toDuration(long value, TimeUnit timeUnit) | |
| toDuration | back to summary |
|---|---|
| private static Duration toDuration(String value, TimeUnit timeUnit) | |