<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<bean id="testTask" class="com.task.TestTask">
<property name="commonDAO" ref="commonDAO"></property>
</bean>
<bean id="testJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="testTask" />
<property name="targetMethod" value="execute" />
<!--将并发设置为false -->
<property name="concurrent" value="false" />
</bean>
<bean id="trigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="testJobDetail" />
<!--表达式,秒分时日月周 -->
<property name="cronExpression" value="0 15 13 * * ?" />
</bean>
<bean id="startQuartz" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false">
<property name="triggers">
<list>
<!--作业调度器,list下可加入其他的调度器 -->
<ref bean="trigger" />
</list>
</property>
</bean>
</beans>
Job:表示一个任务(工作),要执行的具体内容。
JobDetail:表示一个具体的可执行的调度程序,Job 是这个可执行程调度程序所要执行的内容,另外JobDetail 还包含了这个任务调度的方案和策略。
Trigger:代表一个调度参数的配置,什么时候去调。
Scheduler:代表一个调度容器,一个调度容器中可以注册多个 JobDetail 和 Trigger。当 Trigger 与JobDetail 组合,就可以被 Scheduler 容器调度了