Reputation: 203
I build simpy web api services application with Spring Boot, and I created some cron job service with Scheduled task in Spring Boot, but dont working. I need to run this service every week day [Monday-Friday] at 12:00(on day).
That is a exmaple sheduling: @Scheduled(cron="0 1 1 ? * *")
Upvotes: 2
Views: 319
Reputation: 7940
Make sure you include the @EnableScheduling in your config:
@SpringBootApplication
@EnableScheduling
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
}
Cron should be
@Scheduled(cron = "0 0 0 * * MON-FRI")
Good example here
Upvotes: 2
Reputation: 137
Check if you have added the @EnableScheduling
annotation in the configuration class
@SpringBootApplication
@EnableScheduling
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
}
Check this https://spring.io/guides/gs/scheduling-tasks/
Upvotes: 1