如何将石英指向Spring Hikaricp DataSource?
属性设置一个简单的数据源
spring.datasource.username=${database.username}
spring.datasource.password=${database.password}
spring.datasource.url=jdbc:mysql://${database.host}/databasename
我的应用程序是通过hikari autoconfig拾取的
。但是,当使用localdatasourcejobstore
将
<bean id="QuartzClusteredScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<!-- <property name="dataSource" ref="????"/> -->
<property name="jobFactory">
<bean class="com.example.scheduler.AutowiringSpringBeanJobFactory"/>
</property>
<property name="quartzProperties">
<props>
<prop key="org.quartz.jobStore.class">org.springframework.scheduling.quartz.LocalDataSourceJobStore</prop>
<property name="jobDetails">
<list>...
Quartz指向Hikaricp池的正确方法是什么?
如果我归因于数据源,就像我的春季石英autoconfigure的手册所建议的那样,我得到了 java.sql.sqlexception:没有名为'null''
的数据源 如果我放任何其他名称并使用spring.datasource.name = abc
,那么我发现它找不到abc
或jdbc/abc
同样。
我正在尝试了解 https://github.com/spring -Projects/spring-boot/eskity/28758 这似乎是影响我的原因,但是一切都会如此轻松地提到,我不确定如何遵循。
my application is setting a simple data source via properties
spring.datasource.username=${database.username}
spring.datasource.password=${database.password}
spring.datasource.url=jdbc:mysql://${database.host}/databasename
which gets picked up by hikari autoconfig.
But then fail to be seen be quartz autoconfig when using LocalDataSourceJobStore
<bean id="QuartzClusteredScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<!-- <property name="dataSource" ref="????"/> -->
<property name="jobFactory">
<bean class="com.example.scheduler.AutowiringSpringBeanJobFactory"/>
</property>
<property name="quartzProperties">
<props>
<prop key="org.quartz.jobStore.class">org.springframework.scheduling.quartz.LocalDataSourceJobStore</prop>
<property name="jobDetails">
<list>...
What is the correct way to point quartz to the hikariCP pool?
If I ommit the dataSource attributed, like I the manual for spring's quartz autoconfigure suggests, I getjava.sql.SQLException: There is no DataSource named 'null'
If i put any other name and use spring.datasource.name=abc
then i get that it can't find abc
or jdbc/abc
just the same.
I'm trying to understand the discussion on https://github.com/spring-projects/spring-boot/issues/28758 which seems to be what is affecting me, but everything is mentioned so lightly i am not sure how to follow.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在application.properties中明确设置数据源名称。
然后,在您的bean定义中,您可以尝试参考此数据源。
我刚刚在: http:http: //www.masterspringboot.com/programming/various/getting-with-with-quartz-and-spring-boot/
也许您可以从一开始就可以尝试代码。
You can explicitly set the datasource name in your application.properties.
Then in your bean definition, you can try to ref this datasource.
I just found an example at: http://www.masterspringboot.com/programming/various/getting-started-with-quartz-and-spring-boot/
Maybe you can try the code from very beginning.