1)maven 依赖
org.quartz-scheduler quartz 2.2.1 org.springframework spring-context-support 4.1.5.RELEASE
2)spring 配置
3)jobClass
package info.shagri.vpst.web.quartz;import info.shagri.vpst.service.jcsj.CompanyService;import org.quartz.JobExecutionContext;import org.springframework.scheduling.quartz.QuartzJobBean;import com.framework.web.utils.ApplicationContextHolder;/** * 统计所有有效公司各项面积 * */public class StatisComAreasTask extends QuartzJobBean { protected void executeInternal(JobExecutionContext jobExecutionContext) { CompanyService service = ApplicationContextHolder.getBean("companyService"); service.doStatisThenStoreCompanyAreas(); } }