Spring Quartz始终使用RAM作业存储

时间:2019-05-14 14:22:41

标签: java spring-boot quartz-scheduler h2

我在spring + quartz服务中使用以下配置:

spring.datasource.url=jdbc:h2:./scheduler.h2;AUTO_SERVER=TRUE
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driverClassName=org.h2.Driver
spring.quartz.job-store-type=jdbc
spring.quartz.jdbc.initialize-schema=always
spring.quartz.jdbc.commentPrefix=” — “
spring.quartz.properties.org.quartz.threadPool.threadCount=3

但是,它总是以

开头
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered

要使Crystal使用h2数据库实例还需要做些什么?

2 个答案:

答案 0 :(得分:1)

要使用JDBCJobStore,首先需要将Quartz配置的JobStore类属性设置为org.quartz.impl.jdbcjobstore.JobStoreTX或org.quartz.impl.jdbcjobstore.JobStoreCMT

配置石英以使用jobstoretx

org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX

参考: https://dzone.com/articles/mule-quartz-connector-how-to-use-jdbc-jobstore-ins

https://www.candlepinproject.org/docs/candlepin/quartz_setup.html

答案 1 :(得分:0)

结果是我需要添加依赖项

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>