简单3步实现在Spring中使用Quartz

作者:互联网

2009-12-30

Java教程

直接先看spring配置文件:

xmlns:xsi=""
xsi:schemaLocation=" ">



 
 
 
 
  
   
  

 



 
 



 
 
 



 
 
 



 
  
   
  

 


//===================================================

两个类: TestTimerTask 和 Service4Job


import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

public class TestTimerTask extends QuartzJobBean{
private Service4Job service4Job;
public void setService4Job(Service4Job service4Job) {
  this.service4Job = service4Job;
}
@Override
protected void executeInternal(JobExecutionContext arg0)
   throws JobExecutionException {
  this.service4Job.job();
}
}


public class Service4Job {
public void job(){
  System.out.println("**** "+System.currentTimeMillis());
}
}

(thismonth)转贴:

 

本文来自CSDN博客,转载请标明出处: