spring多任务定时配置文件:
<!-- 第一个任务的配置 -->
<bean id="quartzClock"
class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>com.cm.task.action.QueryAndAddTask</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="channelTaskService">
<ref bean="channelTaskService" />
</entry>
</map>
</property>
</bean>
<bean id="quartzClockTask"
class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail">
<ref bean="quartzClock"/>
</property>
<property name="startDelay">
<value>5000</value>
</property>
<property name="repeatInterval">
<value>5000</value>
</property>
</bean>
<bean id="cronQuartzClock"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="quartzClock"></ref>
</property>
<property name="cronExpression">
<value>0 27 16 1 * ?</value>
</property>
</bean>
<!-- 第一个任务的配置 -->
<bean id="offNetClock"
class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>com.cm.task.action.QueryAndUpdateData</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="channelTaskService">
<ref bean="channelTaskService" />
</entry>
</map>
</property>
</bean>
<bean id="offNetClockTask"
class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail">
<ref bean="offNetClock"/>
</property>
<property name="startDelay">
<value>5000</value>
</property>
<property name="repeatInterval">
<value>5000</value>
</property>
</bean>
<bean id="cronOffNetClock"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="offNetClock"></ref>
</property>
<property name="cronExpression">
<value>0 43 16 * * ?</value>
</property>
</bean>
<!-- 调用前面所提到的两个任务 -->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronQuartzClock"></ref>
<ref bean="cronOffNetClock"></ref>
</list>
</property>
</bean>