package com.monkeylessey.job.config; import com.monkeylessey.job.job.TestJob; import org.quartz.*; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * @author 29443 * @date 2022/5/2 */ @Configuration public class TestConfig { @Bean public JobDetail getJobDetail() { return JobBuilder.newJob(TestJob.class) .withIdentity("xp", "top") .storeDurably() .build(); } @Bean public CronTrigger getCronTrigger() { return TriggerBuilder.newTrigger() .startNow() .forJob("xp","top") .withIdentity("xp", "first") .withSchedule(CronScheduleBuilder.cronSchedule("0/10 * * * * ?")) .build(); } }