package com.mandi.quartz; import javax.annotation.PostConstruct; import org.quartz.CronScheduleBuilder; import org.quartz.Trigger; import org.quartz.TriggerBuilder; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; import com.mandi.fendan.util.SendcmErrsheetJob; @Service @Scope("singleton") public class JOBInitializer { @PostConstruct public void init(){ checkcmErr(); } //检查出门发送nc错误的:5分钟执行1次 public void checkcmErr(){ String timer="0 */5 * * * ?"; //todo 先注销了,防止影响调试 /*try{ TriggerBuilder tb=TriggerBuilder.newTrigger(); tb.withIdentity("sendcmErrsheettg", "sendcmErrsheetgp").withSchedule(CronScheduleBuilder.cronSchedule(timer)); Trigger tr=tb.build(); Quartzjob.runJob("sendcmErrsheettask",SendcmErrsheetJob.class, tr); }catch(Exception e){ e.printStackTrace(); }*/ } }