[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 编码查看转换 | 代码下载 | 常见问题及讨论 | Python游戏编程讨论 | 《深入解析ASP核心技术》 | Python游戏编程教程 | AI图片生成
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[备忘]spring+quartz升级quartz版本后报错: There is no DataSource named ...

上一篇:[备忘]我的新加坡攻略
下一篇:没有了

添加日期:2025/9/6 3:22:49 快速返回   返回列表 阅读15次
<dependency>
    <groupId>org.quartz-scheduler</groupId>
    <artifactId>quartz</artifactId>
    <version>2.3.2</version>
</dependency>
------------------------
<bean name="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">  
    <property name="dataSource" ref="dataSourceXXX" />
        <property name="configLocation" value="classpath:quartz.properties" />  
        <property name="autoStartup" value="true" /><!-- 开发时可以改成false -->
    </bean>

quartz.properties里:
---------
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.dataSource = dataSourceXXX
==============================================
莫名其妙,搜了一下,结果如下:
==============================================
之前版本:当配置dataSource后,即使配置文件中已经指定了JobStoreTX,实际还是使用LocalDataSourceJobStore。
LocalDataSourceJobStore使用已经配置的dataSource作为数据源。

升级后的版本:配置文件中指定org.quartz.jobStore.class后,会使用指定的JobStore。该JobStore对应的dataSource需要专门配置。

作者:剑过不留名
链接:https://juejin.cn/post/7078138768997220366
来源:稀土掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

修改方法:
spring.quartz.properties.org.quartz.jobStore.class=org.springframework.scheduling.quartz.LocalDataSourceJobStore
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved