1. 在Myeclipse中导入Quartz.jar包
2.创建两个任务,并配置各自的bean
a。。第一种直接派生QuartzJobBean
public class Report extends QuartzJobBean {
private String name;//通过setter注入值
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
static int i = 100;
@Override
protected void executeInternal(JobExecutionContext arg0)
throws JobExecutionException {
System.out.println(name+i+" send to 总部 at " + new Date());
++i;
try {
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
}
<!--在xml中将Report包装成JobDetaiBean -->