首页 > 代码库 > quartz spring配置

quartz spring配置

官网地址:http://www.quartz-scheduler.org/downloads/

1、第一步

  下载相关jar包

2、配置文件

  

<?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.xsd">

      

    <bean id="jobXXTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">

    <property name="targetObject" ref="taskXXService"/>  

    <property name="targetMethod" value="http://www.mamicode.com/handleXX"/>

    </bean>

    <bean id="triggerXXTask"           class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">

    <property name="jobDetail" ref="jobXXTask" />

    <property name="cronExpression" value="http://www.mamicode.com/0 0/1 * * * ?" />

    </bean>


    

    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">

    <property name="triggers">

    <list>

    <ref bean="triggerXXTask"/>

    </list>

    </property>

    </bean>

    

</beans>



quartz spring配置