升级spring boot异常:DataSource name not set
问题从spring boot 2.2.9升级到2.6.2版本后,启动项目quartz报错Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in class path resource [org/spri
问题
从spring boot 2.2.9升级到2.6.2版本后,启动项目quartz报错
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in class path resource [org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration.class]: Invocation of init method failed; nested exception is org.quartz.SchedulerConfigException: DataSource name not set.
原因
spring-boot-starter-quartz 2.5.6 之前使用org.quartz.impl.jdbcjobstore.JobStoreTX定义quartz的默认数据源支持,如下
org:
quartz:
jobStore:
class: org.quartz.impl.jdbcjobstore.JobStoreTX
解决
2.5.6的版本后将不再支持以上方式进行配置默认数据源,需改为如下配置
org:
quartz:
jobStore:
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
更多推荐
所有评论(0)