Spirngboot使用定时任务 九思_ 2023-02-14 48 阅读1分钟 Spirngboot使用定时任务 启动类增加@EnableScheduling注解 新增业务类,代码如下 @Component public class TimmerTest{ # 每10秒执行一次 @Scheduled(cron = "0/10 * * * * ?") public void timmer(){ System.out.println("定时任务执行了!"); } }