Skip to content

spring boot scheduling #307

Description

@uniquejava

Spring cron expression for every day 1:01:am

show me the java code

@EnableScheduling@SpringBootApplicationpublicclassAwesomeApplication {
}
@Service@Slf4jpublicclassScheduleService {
@AutowiredprivateEventMappereventMapper;
// second, minute, hour, day of month, month, day(s) of week@Scheduled(cron = "0 * * * * *")
voidcheckEvents() {
...
}
}

important note

zone matters in some cases

Scheduled(cron="0 1 1 * * *", zone="Europe/Istanbul")
publicvoiddoScheduledWork() {
//complete scheduled work
}

cron format

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions