@Component
@EnableScheduling
public class TestTask {
@Scheduled(cron = "0/30 * * * * ?")//每30秒执行一次
public void timer() throws Exception{
System.out.println("test");
}
}
@Component
@EnableScheduling
public class TestTask {
@Scheduled(cron = "0/30 * * * * ?")//每30秒执行一次
public void timer() throws Exception{
System.out.println("test");
}
}
本文标题:Spring 定时任务
本文链接:https://www.haomeiwen.com/subject/ugvqwttx.html
网友评论