Spring Boot中的计划任务don';行不通
我使用SpringBoot构建SimpyWebAPI服务应用程序,并使用SpringBoot中的预定任务创建了一些cron作业服务,但不起作用。我需要在每周的12:00(星期一至星期五)运行此服务。Spring Boot中的计划任务don';行不通,spring,Spring,我使用SpringBoot构建SimpyWebAPI服务应用程序,并使用SpringBoot中的预定任务创建了一些cron作业服务,但不起作用。我需要在每周的12:00(星期一至星期五)运行此服务。 这是一个exmaple提示:@Scheduled(cron=“0 1 1?**”)请确保在配置中包含@EnableScheduling: @SpringBootApplication @EnableScheduling public class Application { public s
这是一个exmaple提示:
@Scheduled(cron=“0 1 1?**”)
请确保在配置中包含@EnableScheduling:
@SpringBootApplication
@EnableScheduling
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
}
Cron应该是
@Scheduled(cron = "0 0 0 * * MON-FRI")
好例子检查您是否在配置类中添加了
@EnableScheduling
注释
@SpringBootApplication
@EnableScheduling
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
}
检查这个