简体   繁体   中英

Infinispan transaction - can not get TransactionManager from Spring4

I need to configure Infinispan as cache provider for my Spring project. It's because his transaction functions. The problem is with Spring using PlatformTransactionManager and Infinispan needs javax.transaction.TransactionManager. Is it possible to configure Infinispan TransactionManagerLookup with Spring provided PlatformTransactionManager?

I am using JpaTransactionManager as TransactionManager. Version of Infinispan is 7.2.3.Final, Spring4.

Infinispan TransactionManagerLookup returns a JTA TransactionManager implementation. However you are using a PlatformTransactionManager which has nothing to do with JTA.

So there are at least 2 ways of of dealing with this:

  • You may develop and adapter between PlatformTransactionManager and JTA TransactionManager and return it via TransactionManagerLookup.
  • A much better approach is to configure Spring to use JTA with your entities (you will probably find many example on the internet but the key point here is that you will need some JTA implementation like Narayana for example). Then Infinispan should find the JTA Transaction Manager automatically (or you might specify it manually using TransactionManagerLookup).

It looks like JpaTransactionManager is able to bind only one target and I will need JtaTransactionManager. Hopefully it's possible to bind it under Spring's PlatformTransactionManager.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM