<dependency>
<groupId>bitronix.tm</groupId>
<artifactId>btm</artifactId>
<version>2.1.4</version>
</dependency>
properties
bitronix.tm.journal.disk.logPart1Filename=btm1.tlog
bitronix.tm.journal.disk.logPart2Filename=btm2.tlog
bitronix.tm.journal.disk.logFilesize=50MB
bitronix.tm.journal.memory.name=shared
bitronix.tm.journal.disk.maxLogSizeInMb=50
bitronix.tm.journal.disk.maxForceWaitTime=600
bitronix.tm.timer.defaultTransactionTimeout=60s
bitronix.tm.timer.maxRetryInterval=10s
bitronix.tm.timer.increaseStep=1s
bitronix.tm.timer.txReapingThresholdFactor=5
<bean id="myDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close">
<property name="className" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"/>
<property name="uniqueName" value="myDataSource"/>
<property name="minPoolSize" value="5"/>
<property name="maxPoolSize" value="20"/>
<property name="allowLocalTransactions" value="true"/>
<property name="driverProperties">
<props>
<prop key="user">user</prop>
<prop key="password">password</prop>
<prop key="URL">jdbc:mysql://localhost:3306/mydb</prop>
<prop key="pinGlobalTxToPhysicalConnection">true</prop>
</props>
</property>
</bean>
@Resource
private TransactionManager bitronixTransactionManager;
@Transactional
public void updateData() throws Exception {
try {
bitronixTransactionManager.begin();
bitronixTransactionManager.commit();
} catch (Exception e) {
bitronixTransactionManager.rollback();
throw e;
}
}
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="bitronixTransactionManager"/>
<property name="userTransaction" ref="bitronixTransactionManager"/>
<property name="allowCustomIsolationLevels" value="true"/>
</bean>