Spring JTA TransactionManager config: Supporting both Tomcat and JBoss

后端 未结 5 1087
广开言路
广开言路 2021-02-06 01:19

I have a web application using JPA and JTA with Spring. I would like to support both JBoss and Tomcat. When running on JBoss, I\'d like to use JBoss\' own TransactionManager, an

5条回答
  •  难免孤独
    2021-02-06 01:59

    I think you have missed the point of JNDI. JNDI was pretty much written to solve the problem you have!

    I think you can take it up a level, so instead of using the "userTransaction" or "transactionManager from JNDI" depending on your situation. Why not add the "JtaTransactionManager" to JNDI. That way you push the configuration to the JNDI where it is supposed to be instead of creating even more configuration files [ like there aren't enough already ;) ].

提交回复
热议问题