定时任务
@Component public class TaskTest {
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
int i = 0;
@Scheduled(cron = "0/5 * * * * ?")
public void upload(){
try{
i++;
System.out.println("time:" + sdf.format(new Date()));
if(i < 3){
Thread.sleep(10000);
}
else{
Thread.sleep(100);
}
}
catch (Exception e){
e.printStackTrace();
}
}
}