spring3.x 定時器

1、配置文件中添加

xmlns:task="http://www.springframework.org/schema/task"

http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd

打開定時器

<task:annotation-driven/>

2、業務邏輯註解

@Scheduled(cron="0 */1 * * * ?")
public void receive(){
System.out.println(System.currentTimeMillis());
}

發佈了41 篇原創文章 · 獲贊 4 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章