0

I am trying to understand how the XADataSourceAutoConfiguration relates to the AtomikosJtaConfiguration and more generally the **JtaConfiguration.

More specifically how the two classes below relate to each other:

org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration
org.springframework.boot.autoconfigure.transaction.jta.AtomikosJtaConfiguration

I need a spring boot spring batch application to participate in transactions involving two databases.

Can someone please tell me how the two classes relate to each other?

I was not able to find much documentation in the javadocs API or in the reference documentation about XADataSourceAutoConfiguration.

balteo
  • 23,602
  • 63
  • 219
  • 412

1 Answers1

2

XADataSourceAutoConfiguration is responsible for taking an XADataSource and applying a transaction manager-specific wrapper. That wrapper is how the data source is enlisted in any XA transactions.

AtomikosJtaConfiguration is responsible for configuring Atomikos, including providing the Atomikos-specific XADataSource wrapper that will ensure that Atomikos knows about the XADataSource and enlists it in any XA transactions.

Andy Wilkinson
  • 108,729
  • 24
  • 257
  • 242
  • I also come across XADataSourceAutoConfiguration and XADataSource classes and trying to understand XA transactions in detail.I could not find any spring related documentation regarding how spring implements XA transactions. A detailed resource would be more helpful. – rogue lad Jul 11 '19 at 15:46
  • 1
    Spring does not implement XA transactions. It's Atomikos (as the transaction manager) and the database vendor (as a participant in the transaction) that do so. – Andy Wilkinson Jul 11 '19 at 20:56