quartz 定时器

 <?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:aop="http://www.springframework.org/schema/aop"
 xmlns:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

 <bean id="jobTask" class="com.liuc.comon.JobTask"></bean>
<!-- 定义JobDetail -->
<bean id="jobDetail"
 class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
 <property name="targetObject" ref="jobTask" />
 <property name="targetMethod" value="doJob" />
</bean>

<!-- 使用triggers和SchedulerFactoryBean来包装任务 -->
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
 <property name="jobDetail" ref="jobDetail" />
 <!--                       cron表达式          秒       分 时  日 月  周  (年) -->
 <property name="cronExpression" value="0/15 * * * * ?" />
</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
 <property name="triggers">
  <list>
   <ref bean="cronTrigger" />
  </list>
 </property>
</bean>
</beans>

注:所需的包  commonds-collection-*.jar
                     commonds-logging-*.jar
                     quartz-*.jar
                    spring.jar

 不需要spring 集成的quartz 示例链接:http://thorlst.blog.163.com/blog/static/59275749200862413854176/

原文地址:https://www.cnblogs.com/java20130726/p/3218460.html