The first step:
Create a job class yourself
Package cn.msosm.msshopplatform.scheduler;/** * * @ClassName: Scheduler Create a Job Class * * @Description: the timer to check the order form according to the configuration time Have assigned data to assign red points to white points and get the amount * * @author SUNP * * @date September 15, 2017 PM 4:27:23 * */public class Scheduler {public void execute () { System.out.println ("task begins execution ....") "); System.out.println ("..."); SYSTEM.OUT.PRINTLN ("Task execution complete ....") ");}}
Step Two
Configuring the Task Scheduler in the spring configuration file
<!-- Configure job Class Task Scheduler --><bean id= "Scheduler" class= " Cn.msosm.msShopPlatform.service.scheduler.Scheduler "/><!-- configuration Jobdetail --><bean id= "Springqtzjobmethod" class= " Org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean "><property name=" TargetObject "><ref bean=" Scheduler "/></property><property name=" Targetmethod "> <!-- Name of the method to execute --><value>execute</value></property></bean><!-- Configuration Trigger trigger --><bean id= "Crontriggerfactorybean" class= " Org.springframework.scheduling.quartz.CronTriggerFactoryBean "><property name=" Jobdetail " ref=" Springqtzjobmethod "></property><property name=" cronexpression " value=" 0/5 * * * * ? " ></property><!-- Execution time seconds minutes days weeks --><!- -  Cron expression 1 . Seconds 2 . Minutes 3 . Hours 4 . Day-of-Month 5 . Month 6 . Day-of-Week 7 . year (optional field) --></bean><!-- Configure dispatch factory --><bean id= "Schedulerfactorybean " class=" Org.springframework.scheduling.quartz.SchedulerFactoryBean "><property name=" triggers " ><list><ref bean= "Crontriggerfactorybean"/></list></property></bean>
Step Three:
Tomcat Deployment Run
Springquartz Timer Java