前言
基于SpringBoot实现定时任务
Code
package com.stefanie.sun.bean.TimeTest;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@EnableScheduling
@EnableAsync
@Component
public class TimeTest {
@Scheduled(cron = "0 26 15 * * ?")
public void first(){
System.out.print("15:26定时任务已触发");
}
}