升级spring 版本 quartz异常:DataSource name not set

问题

从spring 5.3.6升级到5.3.18版本后,启动项目quartz报错

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulerFactoryBean' defined in class path resource [com/xxx/xxx/common/job/ScheduleConfig.class]: Invocation of init method failed; nested exception is org.quartz.SchedulerConfigException: DataSource name not set.

原因

从spring5.3.6使用org.quartz.impl.jdbcjobstore.JobStoreTX定义quartz的默认数据源支持,如下

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

解决

spring5.3.18等高版本不在支持以上方式进行配置默认数据源,需要修改为如下配置:

org.quartz.jobStore.class=org.springframework.scheduling.quartz.LocalDataSourceJobStore
# springboot   quartz  

评论

企鹅群:39438021

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×