<dependency> <groupId>org.easy4j</groupId> <artifactId>easy-quartz-spring-boot-starter</artifactId> <version>1.4.0</version> </dependency> spring.datasource.url=jdbc:mysql://localhost:3306/easy_quartz?useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.username=root spring.datasource.password=root spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.quartz.job-store-type=jdbc spring.quartz.jdbc.initialize-schema=always spring.quartz.properties.org.quartz.scheduler.instanceName=EasyQuartzScheduler spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO spring.quartz.properties.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate spring.quartz.properties.org.quartz.jobStore.useProperties=true spring.quartz.properties.org.quartz.jobStore.tablePrefix=qrtz_ public class MyTask extends AbstractJob { @Override public void executeJob(JobExecutionContext context) throws JobExecutionException { } } @SpringBootApplication @EnableEasyQuartz public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } @Component public class MyTaskConfig { @QuartzScheduled(cron = "0/5 * * * * ?") public void myTaskMethod() { } }


上一篇:
下一篇:
切换中文