spring_reference/IV. Spring Boot features/32. Distributed Transaction...

6 lines
732 B
Markdown
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 32. 使用JTA处理分布式事务
Spring Boot使用一个[Atomkos](http://www.atomikos.com/)或[Bitronix](http://docs.codehaus.org/display/BTM/Home)的内嵌事务管理器来支持跨多个XA资源的分布式JTA事务。当部署到一个恰当的J2EE应用服务器时也会支持JTA事务。
当发现一个JTA环境时Spring Boot将使用Spring的JtaTransactionManager来管理事务。自动配置的JMSDataSource和JPA beans将被升级以支持XA事务。你可以使用标准的Spring idioms比如@Transactional来参与到一个分布式事务中。如果你处于JTA环境里但仍旧想使用本地事务你可以将spring.jta.enabled属性设置为false来禁用JTA自动配置功能。