本文共 1576 字,大约阅读时间需要 5 分钟。
创建一个简单的maven 项目
4.0.0 com.etoak.et1904.quartz quartz-spring 1.0-SNAPSHOT jar org.quartz-scheduler quartz 2.3.0 org.springframework spring-jdbc 5.0.7.RELEASE org.springframework spring-tx 5.0.7.RELEASE org.springframework spring-context-support 5.0.7.RELEASE
spring.xml
package com.etoak.job;import java.text.SimpleDateFormat;import java.util.Date;public class SpringJob { public void executeJob(){ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.out.println("Spring Job~"+simpleDateFormat.format(new Date())); }}
package com.etoak;import org.springframework.context.support.ClassPathXmlApplicationContext;public class SpringMain { public static void main(String[] args) { new ClassPathXmlApplicationContext("spring.xml"); }}
转载地址:http://pxvrn.baihongyu.com/