一个项目中jta和jdbc事务配置两个
<!-- spring的ibatis 配制 -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="WEB-INF/SqlMapConfig.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
<!-- spring的ibatis 配制 smsrun 数据库-->
<bean id="atomikosSqlMapClientSmsrun" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="WEB-INF/SqlMapConfig-smsrun.xml" />
<property name="dataSource" ref="atomikosDataSourceSmsrun" />
</bean>
<!--spring 的事务处理类配置-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref local="dataSource" />
</property>
</bean>
<!--atomikos事务-->
<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
init-method="init" destroy-method="close">
<property name="forceShutdown">
<value>true</value>
</property>
</bean>
<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">
<property name="transactionTimeout" value="300" />
</bean>
<bean id="atomikosTtaTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager">
<ref bean="atomikosTransactionManager" />
</property>
<property name="userTransaction">
<ref bean="atomikosUserTransaction" />
</property>
<property name="allowCustomIsolationLevels" value="true"/>
</bean>
<!-- 拦截事物配置-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="prepare*" propagation="REQUIRED" />
<tx:method name="stop*" propagation="REQUIRED" />
<tx:method name="*" propagation="SUPPORTS" />
</tx:attributes>
</tx:advice>
<!-- 拦截事物配置-->
<tx:advice id="jtaAdvice" transaction-manager="atomikosTtaTransactionManager">
<tx:attributes>
<tx:method name="jta*" propagation="REQUIRED" />
<tx:method name="*" propagation="SUPPORTS" />
</tx:attributes>
</tx:advice>
<!--aop 设置切入点-->
<aop:config>
<aop:pointcut id="transactionPointcut"
expression="execution(* com.duowei.*.service.impl.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="transactionPointcut" />
<aop:advisor advice-ref="jtaAdvice" pointcut-ref="transactionPointcut" />
</aop:config>