爱吃鱼油 2017-03-16 07:27 采纳率: 0%
浏览 902

spring + jtom 事务控制

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.2.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
    http://www.springframework.org/schema/util 
    http://www.springframework.org/schema/util/spring-util-3.2.xsd">

    <!-- 引入jdbc配置文件 -->
    <context:property-placeholder location="classpath:conf/jdbc.properties"/>    
    <context:component-scan base-package="com.demo.*"/>
    <!-- 用于获得spring上下文 -->
    <bean id="springContextUtil" class="com.demo.util.SpringContextUtil" />     

    <!-- JTA事务 -->
    <bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/>  

    <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">  
        <property name="userTransaction" ref="jotm" />  
    </bean>  
    <tx:annotation-driven mode="proxy" transaction-manager="txManager" />

    <!--创建数据源dataSource-->
    <bean id="dataSource1" class="org.apache.commons.dbcp2.BasicDataSource">
        <property name="driverClassName" value="${jdbc_driverClassName}" />
        <property name="url" value="${jdbc_url}" />
        <property name="username" value="${jdbc_username}" />
        <property name="password" value="${jdbc_password}" />
    </bean>

    <!--创建数据源dataSource2 -->
    <bean id="dataSource2" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${db2.driver}" />
        <property name="url" value="${db2.url}" />
        <property name="username" value="${db2.username}" />
        <property name="password" value="${db2.password}" />
    </bean>

    <!-- JTA Test begin -->
    <bean id="template1" class="org.springframework.jdbc.core.JdbcTemplate">  
        <property name="dataSource" ref="dataSource1" />  
    </bean>    
    <bean id="template2" class="org.springframework.jdbc.core.JdbcTemplate">  
        <property name="dataSource" ref="dataSource2" />  
    </bean>        
    <!-- JTA Test begin -->
</beans>

没有这个类JotmFactoryBean我知道,我想问的是怎么解决谢谢

  • 写回答

2条回答

  • 爱吃鱼油 2017-03-16 07:28
    关注





    评论

报告相同问题?

悬赏问题

  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题
  • ¥60 高价有偿求java辅导。工程量较大,价格你定,联系确定辅导后将采纳你的答案。希望能给出完整详细代码,并能解释回答我关于代码的疑问疑问,代码要求如下,联系我会发文档