@Target(value={METHOD,ANNOTATION_TYPE}) @Retention(value=RUNTIME) @Documented @Repeatable(value=Schedules.class) public @interface Scheduled
cron()
, fixedDelay()
, or fixedRate()
attributes must be specified.
The annotated method must expect no arguments and have a
void
return type.
Processing of @Scheduled
annotations is performed by
registering a ScheduledAnnotationBeanPostProcessor
. This can be
done manually or, more conveniently, through the <task:annotation-driven/>
element or @EnableScheduling
annotation.
EnableScheduling
,
ScheduledAnnotationBeanPostProcessor
,
Schedules
Modifier and Type | Optional Element and Description |
---|---|
String |
cron
A cron-like expression, extending the usual UN*X definition to include
triggers on the second as well as minute, hour, day of month, month
and day of week.
|
long |
fixedDelay
Execute the annotated method with a fixed period between the end
of the last invocation and the start of the next.
|
String |
fixedDelayString
Execute the annotated method with a fixed period between the end
of the last invocation and the start of the next.
|
long |
fixedRate
Execute the annotated method with a fixed period between invocations.
|
String |
fixedRateString
Execute the annotated method with a fixed period between invocations.
|
long |
initialDelay
Number of milliseconds to delay before the first execution of a
fixedRate() or fixedDelay() task. |
String |
initialDelayString
Number of milliseconds to delay before the first execution of a
fixedRate() or fixedDelay() task. |
String |
zone
A time zone for which the cron expression will be resolved.
|
public abstract String cron
"0 * * * * MON-FRI"
means once per minute on
weekdays (at the top of the minute - the 0th second).CronSequenceGenerator
public abstract String zone
TimeZone.getTimeZone(String)
,
or an empty String to indicate the server's default time zoneCronTrigger.CronTrigger(String, java.util.TimeZone)
,
TimeZone
public abstract long fixedDelay
public abstract String fixedDelayString
public abstract long fixedRate
public abstract String fixedRateString
public abstract long initialDelay
fixedRate()
or fixedDelay()
task.public abstract String initialDelayString
fixedRate()
or fixedDelay()
task.