Spring Scheduled定时任务

使用Spring执行定时器

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

 

只需要引入Spring的context包即可

@Component
//启动开启定时任务
@EnableScheduling
public class HbaseFileReload {

    //执行任务周期 cron表达式
    @Scheduled(cron = "0 0/1 * * * ?")
    public void run() {
        System.out.println("test");
    }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章