Skip to content
SpringCronTools

spring · cron · @Scheduled

Spring Cron Expression Generator

Build, check and understand the six-field cron strings Spring @Scheduled understands — with the exact next execution times.

second · minute · hour · day-of-month · month · day-of-week

Valid Spring cron— Every 5 minutes

next in 3 min

java @scheduled

@Scheduled(cron = "0 */5 * * * *")

next executions

Next execution times
timedatein
02:15:00Sun, 4 Oct 2026in 3 min
02:20:00Sun, 4 Oct 2026in 8 min
02:25:00Sun, 4 Oct 2026in 13 min
02:30:00Sun, 4 Oct 2026in 18 min
02:35:00Sun, 4 Oct 2026in 23 min

examplesWhat are the most common schedules?

all 14

basicsWhat is a Spring Cron expression?

It is the schedule string you pass to @Scheduled(cron = ...) or to a CronTrigger. Spring parses it with its own CronExpression class, which follows classic cron numbering and adds the Quartz-style day constructs L, W and #. The six-field reference has the details.

fieldsWhat are Spring's six fields?

second minute hour day-of-month month day-of-week. The seconds field has no default, so the Unix expression 0 9 * * 1-5 has no direct Spring equivalent — it needs to become 0 0 9 ? * 1-5. The Unix to Spring converter does that for you.

vs unixHow does Spring cron differ from Unix cron?

Unix cron has five fields and no seconds field. It also treats two restricted day fields as OR, while Spring requires both to match. Read the Spring vs Unix cron guide for the conversion rules.

Spring cron compared with Unix cron
DifferenceUnix cronSpring
Field count56 (seconds first)
Hour range0-230-23
Both day fields restrictedOR — either may matchAND — both must match
L / LW / W / #not supportedsupported
Weekdays at 9 AM0 9 * * 1-50 0 9 ? * 1-5

vs quartzHow does it differ from Quartz cron?

The syntax is nearly identical, but Quartz numbers days 1-7 with SUN = 1, while Spring uses 0-7 with 0 = Sunday. So Quartz 6L (last Friday) is Spring 5L. Details in Spring vs Quartz cron.

Spring cron compared with Quartz cron
ConstructQuartzSpring
Sunday10 (or 7)
Monday to Friday2-61-5
Last Friday of the month0 0 0 ? * 6L0 0 0 * * 5L
Year field7th fieldnot supported
L, LW, W, #supportedsupported

mistakesWhich @Scheduled mistakes are common?

  • Pasting a five-field Unix expression. Use the Unix to Spring converter first.
  • Leaving the seconds field out, or writing * * * * * * and getting 60 runs a minute.
  • Restricting both day fields and expecting OR semantics. Use ? for the field you do not care about.
  • Assuming the JVM default timezone. Pin it with zone = "Europe/Berlin".

referencesSources

A Spring cron expression is six space-separated fields — second, minute, hour, day-of-month, month, day-of-week — read left to right.
Field order per the CronExpression reference; the wording here is this site's, not a quotation from it.

Found a rule this site gets wrong? The parser is one file: the six-field reference lists every construct it accepts.

Questions

What is a Spring Cron expression?

A Spring Cron expression is the six-field schedule used by @Scheduled(cron = "...") and CronTrigger. The fields are second, minute, hour, day-of-month, month and day-of-week, in that order.

How many fields does a Spring cron expression have?

Six. Unlike Unix cron, the seconds field is mandatory and always comes first, so "0 9 * * 1-5" is not a valid Spring expression.

Does Spring support L, W and #?

Yes. Spring follows the Quartz day syntax: L for the last day of the month, L-<n> for an offset from the end, LW for the last weekday, <n>W for the weekday nearest a day, <dow>L for the last such weekday in the month and <dow>#<n> for the nth one.

How do I run a job every 5 minutes in Spring?

Use @Scheduled(cron = "0 */5 * * * *"). The seconds field is 0, the minute field steps by 5.