spring3.x 定时器

来源:互联网 发布:我的世界java问题 编辑:程序博客网 时间:2024/05/01 23:53

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());
}

0 0
原创粉丝点击