1 在 spring boot 的啓動類上 加上
@EnableScheduling 註解
2 編寫 定時任務類。
@Component
public class ReservationInformationScheduleTask {
/**
* 每月1號定時生成下月的預約信息
*/
@Scheduled(cron = "0 0 0 1 * ?")
public void testSchedule(){
System.out.println("this is my test schedule");
}
}