在SpringBoot中设置定时任务 1、导入SpringBoot依赖 2、在启动类上标注@EnableScheduling注解 3、在任务上使用cron表达式 关于cron表达式写法可以参考cron详解 在线Cron表达式生成器