以下是spring完成的配置文件,只需在applicationContext.xml中引入这个xml就可以了
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<bean id="schedulerFactoryBean"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cornTrigger" />
</list>
</property>
</bean>
<bean id="cornTrigger"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<!-- 指向调度方案的ID-->
<ref bean="ftpUpload" />
</property>
<property name="cronExpression">
<value>* 30 * 1 * ?</value>
</property>
</bean>
<!-- 定义个调度方案的ID-->
<bean id="ftpUpload"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 调度的类的bean的ID-->
<property name="targetObject" ref="backup"/>
<!-- 调度的类的bean的中的方法-->
<property name="targetMethod" value="backupTodayFile" />
</bean>
<!-- 调度的类的bean-->
<bean id="backup" class="com.ylink.jzcg.services.handle.ControlHandle"></bean>
</beans>