Posted on 2008-07-11 23:44
leekiang 阅读(274)
评论(0) 编辑 收藏 所属分类:
spring
0 0-15 23 * * ? 每天23:00至23:15每分钟触发一次
0 0/5 * * * ? 每隔5分钟触发一次
0 15 10 L * ? 每月最后一日的上午10:15触发
bean配置的顺序:
定时器的工厂bean-->cronbean-->具体实现的bean
<bean
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronExpReport" />
</list>
</property>
</bean>
<!-- 每天23:00至23:15每分钟一次触发 -->
<bean id="cronExpReport"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="detailBean" />
</property>
<property name="cronExpression">
<value>0 0-15 23 * * ?</value>
</property>
</bean>
<bean id="detailBean"
class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>com.bo.detailBO</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="baseBO">
<ref bean="baseBO" />
</entry>
</map>
</property>
</bean>
Define of cronExpression
+------------------------------------+
| Position | Meaning | Value Scope |
+------------------------------------+
| 1 | second | 0-59 |
+------------------------------------+
| 2 | minute | 0-59 |
+------------------------------------+
| 3 | hour | 0-23 |
+------------------------------------+
| 4 | day | 1-31 |
+------------------------------------+
| 5 | month | 1-12 |
+------------------------------------+
| 6 | week | 1-7 |
+------------------------------------+
| 7 可选 | year | 1970-2099 |
+------------------------------------+
http://hi.baidu.com/tonent/blog/item/894e8b525124960a0cf3e3a1.html
http://blog.csdn.net/changsure/archive/2007/03/27/1542194.aspx
http://www.xici.net/b391997/d26742282.htm