import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
@SuppressWarnings("all")
@EnableScheduling //如果不加这个注解,定时器启动不了,这句话的作用类似于Spring的xml命名空间<task:*>
public class ScheduledTasks{
// @Autowired
// private XXXXService xxxxService;
//每天凌晨两点执行此函数执行
@Scheduled(cron = "00 00 2 * * ?")
public void test() throws IOException {
System.out.println("11111hahaha");
}
}