SpringBoot定时任务如何在Java中使用-创新互联
这篇文章将为大家详细讲解有关SpringBoot定时任务如何在Java中使用,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
一、SpringBoot使用Schedule
核心代码:
@Component public class ScheduleTask { private Logger logger = LoggerFactory.getLogger(ScheduleTask.class); @Scheduled(cron = "0/1 * * * * ? ") public void one() { logger.info("one:" + new Date()); } @Scheduled(cron = "0/1 * * * * ? ") public void two() { logger.info("two:" + new Date()); } @Scheduled(cron = "0/1 * * * * ? ") public void three() { logger.info("three:" + new Date()); } }
当前名称:SpringBoot定时任务如何在Java中使用-创新互联
网站路径:http://tyjierui.cn/article/djiged.html