问题描述
我正在尝试在Spring Boot中设置Bitronix,以将最后的资源与非XA数据源一起使用.当然,默认情况下(自动配置)数据源不参与XA事务.似乎org.springframework.boot.jta.XADataSourceWrapper
仅适用于XADataSource
.
I'm trying to set-up Bitronix in Spring Boot to use last resource gambit with non-XA datasource. Of course by default (autoconfiguration) data source does not participate in XA transaction.It seems that org.springframework.boot.jta.XADataSourceWrapper
will work only for XADataSource
.
如何将DataSource
与Bitronix连接?
How to connect DataSource
with Bitronix?
推荐答案
Bitronix使用其 LrcXADataSource
来实现最后的资源优势.您需要告诉Spring Boot创建该类型的XAResource
:
Bitronix uses its LrcXADataSource
to implement the last resource gambit. You need to tell Spring Boot to create an XAResource
of that type:
spring.datasource.xa.data-source-class-name=bitronix.tm.resource.jdbc.lrc.LrcXADataSource
您还需要设置一些其他属性,这些属性取决于您使用的数据库及其配置方式.例如,JDBC驱动程序类的名称:
You'll also need to set some other properties that will depend on the database you're using and how it's configured. For example, the name of the JDBC driver class:
spring.datasource.xa.properties.driver-class-name=org.hsqldb.jdbcDriver
这篇关于如何设置Spring Boot + Bitronix +非XA数据源+ XA JMS连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!