使用spring mvc 设置方法定时执行
来源:互联网 发布:淘宝3c认证编号 编辑:程序博客网 时间:2024/06/06 00:15
需要配置的项:
1,spring- context.xml 下的包扫描:component-scan :将 设置定时方法所在的类的包加入自动扫描的目录里。
2.spring- context.xml 添加 <task:annotation-driven/>
3.编写定时方法: 1.在该方法所属的类下 加入注解 @Component 在该方法上 加入注解 @Scheduled(cron="*/20 * * * * ? ")//二十秒执行一次
eg:
/**
* @author liuyuanjing 2016-01-08
* 设置执行点击率持久化的定时器*/
@Component
public class ClickRateTimeToPersistence {
//设置定时执行
@Scheduled(cron="*/20 * * * * ? ") //二十秒执行一次
public void main(){
system.out.println(1);
}
}
0 0
- 使用spring mvc 设置方法定时执行
- Spring MVC使用Quartz定时执行
- Spring MVC执行定时任务
- Spring MVC quartz定时执行问题
- Spring定时执行某个类/方法;
- 使用spring @Scheduled注解执行定时任务、
- 使用Spring Quartz执行定时任务
- 使用spring @Scheduled注解执行定时任务、
- 使用spring @Scheduled注解执行定时任务
- 使用spring @Scheduled注解执行定时任务
- maven构建使用Spring执行定时任务
- 使用spring @Scheduled注解执行定时任务
- 使用spring @Scheduled注解执行定时任务、
- 使用spring @Scheduled注解执行定时任务
- 使用spring @Scheduled注解执行定时任务
- 使用spring @Scheduled注解执行定时任务
- 使用spring @Scheduled注解执行定时任务
- 使用spring @Scheduled注解执行定时任务
- 程序员的成长和代码行数的关系
- bzoj3998 弦论
- R 语言绘图006-绘图参数设置函数par()详解
- 3714: [PA2014]Kuglarz 思路题 最小生成树
- mysql数据库还原出错ERROR:Unknown command ‘\\’解决手记
- 使用spring mvc 设置方法定时执行
- 大数据分析技术生态圈一览
- css导入
- mysql 完整性约束
- error C2664: “CButton::Create”: 不能将参数 1 从“const char [1]”转换为“LPCTSTR
- intellij idea 添加动态 user library(java.lang.VerifyError)
- 导入第三方细节
- mvp模式
- Variable ‘time_zone’ can’t be set to the value of ‘NULL’解决方法