Spring Boot 2 disable Autocommit Hikari with multiple datasources

╄→尐↘猪︶ㄣ 提交于 2019-12-03 17:08:38

I am using Spring Boot 2.0.4.RELEASE, and faced the same problem. Spent hours with related posts showing non-working properties...

Removing .hikari worked for me.

spring.datasource.ucm.autocommit=false

Alternative solution to your problem, configure default-auto-commit property as false. It should also work.

spring.datasource.ucm.default-auto-commit=false

Spring Boot Ref 1

default.auto-commit

Make false default-auto-commit should work.

spring.datasource.ucm.default-auto-commit=false

I know that this is very late but this issue exploded my brain for ~2 days and this post is at the top of google search so I will post here the solution for others.

It's actually quite simple, just that I missed it in the docs here https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-two-datasources

log story short make sure that you add .type(HikariDataSource.class) before you build your class.

Also if you use jhipster you should also point your config to the hikari part like this @ConfigurationProperties("spring.datasource.other.hikari")

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!