Spring @Scheduled
Build Spring Framework @Scheduled cron expressions with the 6-field syntax, the zone attribute, and Spring-specific quirks.
Last verified: 2026-05-15
Six fields, Spring-flavored Quartz
Spring's @Scheduled(cron = ...) uses a 6-field expression: second minute hour day-of-month month day-of-week. There is no year field — the seventh column found in classic Quartz is not supported here.
@Scheduled(cron = "0 0 9 * * MON-FRI", zone = "Europe/Berlin")
public void morningKickoff() { /* ... */ }The zone attribute
Spring honors a zone attribute on @Scheduled that accepts any IANA zone identifier. Without it, schedules run in the JVM's default timezone — which is rarely what you want in a containerized deployment, where the container often defaults to UTC.
Day-of-week numbering subtleties
Spring historically used 0-6 (Sun-Sat) but switched to 1-7 (Mon-Sun) as part of moving to Quartz-style parsing. As of Spring 5.3+, the supported numbering is 1 = MON, 7 = SUN — which is yet another convention, different from both Unix (0=SUN) and AWS/Quartz (1=SUN). Use the alphabetic form (MON-FRI) for unambiguous schedules.
cron.expression properties
Hardcoded cron strings rot fast. Externalize them to application.properties with @Scheduled(cron = "$${my.cron}") so deployment-time tuning doesn't require a recompile. The default property-placeholder resolver handles this directly.
Spring vs. classic Quartz subtleties
- Spring does not support the
?character — use*instead. - Spring does not support
L,W, or#— for those, integrate Quartz directly. - Spring accepts a special
-value meaning "never run", used to disable a scheduled task via configuration.
Found something inaccurate? Email hello@cronpreview.com.