Cron Builder

Spring Boot cron expression visual builder, 6-field format, 14 presets, live next-5-trigger preview.

Quick Presets

Field Builder

Day of Week

Month

Cron Expression

0 0 8 * * ?
Sec
Min
Hour
Day
Month
Weekday

Spring Boot

@EnableScheduling  // 启动类上添加
@Scheduled(cron = "0 0 8 * * ?")
public void scheduledTask() {
    // 定时任务逻辑
}

Next 5 Trigger Times

#104/23/2026, 08:00:00
#204/24/2026, 08:00:00
#304/25/2026, 08:00:00
#404/26/2026, 08:00:00
#504/27/2026, 08:00:00

How does Spring Boot cron differ from Linux cron?

Linux crontab uses 5 fields (min hour dom month dow). Spring Boot's @Scheduled(cron) uses 6 fields (sec min hour dom month dow) — with an extra 'seconds' field at the start. This is the most common gotcha.

What's the difference between ? and *?

* matches every value in that field. ? means 'no specific value' and can only be used in the day-of-month (DOM) and day-of-week (DOW) fields. When you specify one, set the other to ? to avoid ambiguity.

How do I run every 5 minutes?

Use the step syntax /: 0 */5 * * * ? fires every 5 minutes (at 0, 5, 10…55). The 0 in the seconds field ensures it fires at exact minute boundaries.

How do I run only on weekdays?

Set the DOW field to MON-FRI (or 1-5) and the DOM field to ?. Example: 0 0 9 ? * MON-FRI runs every weekday at 9 AM. Spring Boot supports SUN/MON/TUE/WED/THU/FRI/SAT abbreviations.

What annotations are needed to activate a scheduled task?

Two steps: ① add @EnableScheduling to your main class; ② add @Scheduled(cron = "...") to the method. The method's class must be a Spring-managed bean (@Component, @Service, etc.).