タイミングタスク
package com.doudou.task;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.support.CronTrigger;
public class BackgroundTask {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
public void start(){
if(scheduler != null){
scheduler.initialize();
}
scheduler.schedule(new TaskRunable(), new CronTrigger("0/5 * * * * ?"));
}
public void stop(){
if(scheduler != null){
scheduler.shutdown();
}
}
}