Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring Boot中的计划任务don';行不通_Spring - Fatal编程技术网

Spring Boot中的计划任务don';行不通

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

我使用SpringBoot构建SimpyWebAPI服务应用程序,并使用SpringBoot中的预定任务创建了一些cron作业服务,但不起作用。我需要在每周的12:00(星期一至星期五)运行此服务。
这是一个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);
    }
}
检查这个