SpringBoot 2.1.1.RELEASE 集成quartz http://www.qchcloud.cn/system/article/show/70 依赖配置:
<!-- 定时任务 -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
</dependency>
定时任务:
@Component @Configurable @EnableScheduling public class WorkJobQuartz { public long count=0; private static final Logger log = LoggerFactory.getLogger(WorkJobQuartz.class); @Scheduled(cron="*/5 * * * * *") public void reportByCron(){ log.debug("reportCount:"+count+++""); } }