Spring Boot @Scheduled Cron vs. Quartz: Key Differences
Spring Framework 5.3 replaced legacy CronSequenceGenerator with org.springframework.scheduling.support.CronExpression, aligning Spring’s 6-field parser with L, W, and # calendar modifiers while keeping POSIX day-of-week numbering (0 or 7 = Sunday). Unlike Quartz, Spring does not accept a 7th Year field and allows * in both day-of-month and day-of-week without throwing an exception.
Always pair @Scheduled(cron = "...", zone = "UTC") with an explicit IANA zone string so container locale differences between developer laptops and Linux production images never shift billing or report batches.
- Exact 6 Fieldssecond · minute · hour · day-of-month · month · day-of-week (Spring rejects 5-field POSIX and 7-field Year expressions).
- Spring 5.3+ FeaturesSupports L, W, # modifiers, ? alias for *, macros (@hourly, @daily, @weekly, @monthly), and "-" to disable a scheduled job.
- Day Numbering0 and 7 both equal Sunday (POSIX-aligned), unlike Quartz where 1 = Sunday. Use MON–SUN names for clarity.
How do I disable a Spring @Scheduled cron job via application.yml without removing the annotation?
Spring 5.1+ recognizes the special cron value "-" (e.g., app.job.cron: "-") to disable the scheduled task cleanly per environment.
Why does day-of-week 1 mean Monday in Spring but Sunday in Quartz?
Spring follows POSIX numbering (0/7 = Sunday, 1 = Monday..6 = Saturday), while Quartz and AWS EventBridge use 1 = Sunday..7 = Saturday. Using MON-FRI works identically in both.