Spring定时器
来源:互联网 发布:淘宝人参怎么这么便宜 编辑:程序博客网 时间:2024/06/01 10:28
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!-- 需要spring-support.jar包 -->
<bean id="job" class="com.njg.spider.job.BaseJob">
<property name="taskDao" ref="taskDao" ></property>
</bean>
<bean id="quartzClock" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="job"/>
<property name="targetMethod" value="start"/>
<property name="concurrent" value="false"/>
</bean>
<bean id="spider" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="quartzClock"></property>
<property name="cronExpression">
<!-- 每天上午8点,12点,下午4点执行定时器 定时更新当天的信息 -->
<value>0 0 8,12,16 * * ?</value>
<!-- 一个cron表达式有至少6个(也可能是7个)由空格分隔的时间元素.从左到右,这些元素的定义如下:
1.秒(0-59)
2.分钟(0-59)
3.小时(0-23)
4.月份中的日期(1-31)
5.月份(1-12或SUN-DEC)
6.星期中的日期(1-7或SUN-SAT)
7.年份(1970-2099)
例子:
0 0 10,14,16 * * ? 每天上午10点,下午2点和下午4点
0 0,15,30,45 * 1-10 * ? 每月前10天每隔15分钟
30 0 0 1 1 ? 2012 在2012年1月1日午夜过30秒时
0 0 8-5 ? * MON-FRI 每个工作日的工作时间
- 区间
* 通配符
? 你不想设置那个字段
-->
</property>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="spider"></ref>
</list>
</property>
</bean>
</beans>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!-- 需要spring-support.jar包 -->
<bean id="job" class="com.njg.spider.job.BaseJob">
<property name="taskDao" ref="taskDao" ></property>
</bean>
<bean id="quartzClock" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="job"/>
<property name="targetMethod" value="start"/>
<property name="concurrent" value="false"/>
</bean>
<bean id="spider" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="quartzClock"></property>
<property name="cronExpression">
<!-- 每天上午8点,12点,下午4点执行定时器 定时更新当天的信息 -->
<value>0 0 8,12,16 * * ?</value>
<!-- 一个cron表达式有至少6个(也可能是7个)由空格分隔的时间元素.从左到右,这些元素的定义如下:
1.秒(0-59)
2.分钟(0-59)
3.小时(0-23)
4.月份中的日期(1-31)
5.月份(1-12或SUN-DEC)
6.星期中的日期(1-7或SUN-SAT)
7.年份(1970-2099)
例子:
0 0 10,14,16 * * ? 每天上午10点,下午2点和下午4点
0 0,15,30,45 * 1-10 * ? 每月前10天每隔15分钟
30 0 0 1 1 ? 2012 在2012年1月1日午夜过30秒时
0 0 8-5 ? * MON-FRI 每个工作日的工作时间
- 区间
* 通配符
? 你不想设置那个字段
-->
</property>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="spider"></ref>
</list>
</property>
</bean>
</beans>
阅读全文
0 0
- spring定时器
- Spring定时器
- Spring 定时器
- Spring定时器
- spring定时器
- Spring定时器
- spring 定时器
- Spring定时器
- spring定时器
- Spring定时器
- spring 定时器
- spring 定时器
- spring 定时器
- Spring定时器
- spring定时器
- spring 定时器
- spring 定时器
- spring定时器
- 让Unity3d Keystore记住密码
- 快速幂
- 方法的重载
- 从头到尾讲Webpack-实例篇(多种方法实现)
- 虹膜识别之区域生长法
- Spring定时器
- 玄宇说:JQ实现键盘回车搜索
- RecycleView下的二次贝塞尔购物车轨迹曲线
- java 类静态代码块变量和类成员命名一样
- IOS挖坑之路3 tableview造成整个界面第一次点击失效
- MFC放大缩小界面,使控件跟着放大缩小
- java 21点
- Java8的一个小缺点
- 学习Swing组件对话框时犯的低级错误