Spring实现定时任务
来源:互联网 发布:网上看房用什么软件 编辑:程序博客网 时间:2024/04/30 11:02
Spring定时任务示例
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"><beans><!-- 数据拉取 --><bean id="getMsg" class="org.springframework.scheduling.quartz.JobDetailBean"><property name="jobClass"value="com.svw.wehr.wechat.message.timer.GetWxMsgTask" /></bean><!-- 数据拉取同步 --><bean id="getWXMsgTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"><property name="jobDetail" ref="getMsg" /><!-- <property name="cronExpression" value="0 */1 * * * ?" /> 1分钟--><!-- 每日凌晨两点 --><property name="cronExpression" value="0 0 2 * * ?" /></bean><!-- 触发器 --><bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"><property name="triggers"><list> <ref bean="getWXMsgTrigger" /></list></property></bean></beans>
package com.wechat.message.timer;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Date;import java.util.HashSet;import java.util.List;import java.util.Set;import org.apache.commons.lang3.StringUtils;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.quartz.JobExecutionContext;import org.quartz.JobExecutionException;import org.springframework.context.support.ClassPathXmlApplicationContext;import org.springframework.scheduling.quartz.QuartzJobBean;public class GetWxMsgTask extends QuartzJobBean { /** * 日志 */ private static final Log log = LogFactory.getLog(GetWxMsgTask.class); @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { log.info("定时任务开始跑啦!!!!"); }}
0 0
- Spring 定时任务实现
- Spring实现定时任务
- Spring实现定时任务
- Spring 实现定时任务
- Spring实现定时任务
- spring 实现定时任务
- Spring定时任务实现
- spring定时任务+线池程实现
- 通过Spring实现定时任务
- 整合spring实现定时任务
- spring定时任务+线池程实现
- Spring实现定时启动任务
- spring定时任务的实现
- Spring+Quartz实现定时任务
- Spring 定时任务的实现
- spring定时任务+线池程实现
- Spring 3实现定时任务
- Spring 定时任务的实现
- 结构型模式--适配器模式
- node.js获取请求参数
- 第9周项目1-利用循环程序求和 A
- PLSQL中文乱码问题,为什么oracle问题那么多
- 从海康的ps流中提取h264数据
- Spring实现定时任务
- scrollview can host only one direct child
- 在XEN环境中实现VLAN
- 保罗·格雷厄姆创业讲堂二:团队与执行
- 解决java中ZipFile解压缩时候的中文路径和乱码问题
- scikit-learn使用joblib持久化模型过程中的问题详解
- shell资料
- Core Data结构修改,升级,迁移,后,在AppStore中更新升级crash的问题.
- codeforces 431B Shower Line