Quartz写个简单的定时任务
spring+maven+Quartz定时任务 1.首先我们在项目中引进Quartz,pom.xml中添加如下包 1 <dependency> 2 <groupId>org.quartz-scheduler</groupId> 3 <artifactId>quartz</artifactId> 4 <version>2.2.1</version> 5 </dependency> View Code 2.在web.xml中有如下配置 1 <!-- Context ConfigLocation --> 2 <context-param> 3 <param-name>contextConfigLocation</param-name> 4 <param-value>classpath*:/spring-context*.xml</param-value> 5 </context-param> View Code 3.添加spring-context-quartz.xml配置文件,专门配置定时任务,1.startQuartz总管理类,启动触发器的配置,2.配置触发器及触发器关联的详细任务。 1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans"