<!-- spring 線程調度註冊, 註冊執行的任務 class 和 被執行的 service -->
<bean id="deptSyncJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>com.openid.rst.server.quartz.DepartmentSyncJob</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="someService">
<ref bean="someService"/>
</entry>
</map>
</property>
</bean>spring
<!-- this
/** 實現的線程執行類 */線程
package com.openid.rst.server.quartz;server
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import com.openid.rst.service.SecurityService;
import org.springframework.scheduling.quartz.QuartzJobBean;get
public class DepartmentSyncJob extends QuartzJobBean {it
public SecurityService getSecurityService() {
return this.securityService;
}io
public void setSecurityService(SecurityService securityService) {
this.securityService = securityService;
}class
private SecurityService securityService;
import
protected void executeInternal(JobExecutionContext context)
throws JobExecutionException {
securityService.doDeptSyncFromIddbuser();
}配置
}
-->
<!-- spring 配置線程調用及參數 -->
<bean id="simpleReportTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail">
<ref bean="deptSyncJob"/>
</property>
<!--
<property name="startDelay">
<value>1800000-nouse </value>
</property>
-->
<property name="startDelay">
<value>12000</value>
</property>
<property name="repeatInterval">
<value>86400000</value>
</property>
</bean>
<!-- 線程執行工廠 -->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="simpleReportTrigger"/> </list> </property> </bean>