.xml配置文件
<bean id="jobSchedule" class="com.mesclouds.pbsup.controller.JobScheduler"></bean>
<context:property-placeholder location="/WEB-INF/config/timer.properties" /><bean id="jobDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="jobSchedule"></property>
<property name="targetMethod" value="start"></property>
<property name="concurrent" value="false"></property>
</bean>
<bean id="jobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="jobDetail"></property>
<property name="cronExpression">
<value>${sycn.timer}</value>
</property>
</bean>
<bean id="warnNeedReCheckTask"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="jobSchedule"></property>
<property name="targetMethod" value="warnNeedReChecktask"></property>
<property name="concurrent" value="false"></property>
</bean>
<bean id="jobTrigger_warnNeedReCheckTask" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="warnNeedReCheckTask"></property>
<property name="cronExpression">
<value>${recheck.warnning.timer}</value>
</property>
</bean>
<bean id="checkProjectisSelf"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="jobSchedule"></property>
<property name="targetMethod" value="checkProjectisSelf"></property>
<property name="concurrent" value="false"></property>
</bean>
<bean id="jobTrigger_checkProjectisSelf" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="checkProjectisSelf"></property>
<property name="cronExpression">
<value>${check.warnning.timer}</value>
</property>
</bean>
<bean name="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="applicationContextSchedulerContextKey" value="application"></property>
<property name="triggers">
<list>
<ref bean="jobTrigger"/>
<ref bean="jobTrigger_warnNeedReCheckTask"/>
<ref bean="jobTrigger_checkProjectisSelf"/>
</list>
</property>
</bean>
timer.poperties-->配置文件信息
sycn.timer = 0 0 2 * * ?
recheck.warnning.timer = 0 0 8 * * ?
check.warnning.timer = 0 0 7 * * ?
java文件
public class JobScheduler {
//@Scheduled(cron = "0 0 12 * * ?")
public void start()
{
System.out.println("同步计时器 : " );
}
/**
* 预警需要复检的单据
*/
public void warnNeedReChecktask()
{
System.out.println("预警复检单据计时器 : " );
}
/**
* 查看自检项目
*/
public void checkProjectisSelf()
{
System.out.println("预警巡检单据计时器 : " );
}
}