Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)

I'm trying to have my code execute on a fixed schedule, based on a Spring cron expression. I would like the code to be executed every day at 1:01:am. I tried the following expression, but this didn't fire up for me. What's wrong with the syntax here?

@Scheduled(cron = "0 1 1 ? * *")

public void resetCache() {

    // ...

}

1 Answer

0 votes
by (46k points)
You can use annotate your method with @Scheduled(cron ="0 1 1 * * ?").

0 - is for seconds

1- 1 minute

1 - hour of the day.

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...