每次都执行很多次
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class CsTask {
@Scheduled(cron = "0/10 * * * * ?")
public void taskCron(){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
simpleDateFormat.applyPattern("yyyy-MM-dd HH:mm:ss");
String sdf = simpleDateFormat.format(new Date());
System.out.println("cron: " + sdf);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…