- 浏览: 371675 次
- 性别:
- 来自: 南京
文章分类
- 全部博客 (209)
- db2 (4)
- oracle (1)
- sqlserver (16)
- java (54)
- jdbc (3)
- html、js (21)
- MQ、MB (6)
- uml (3)
- 格言 (7)
- 笑话 (3)
- 管理 (5)
- note (10)
- hibernate (1)
- 设计模式 (4)
- win8 (5)
- postgre (2)
- cxf (3)
- MyBatis (4)
- tomcat (9)
- servlet (2)
- ant (2)
- spring (5)
- windows (3)
- linux (7)
- struts2 (2)
- android (2)
- eclipse (1)
- drools (1)
- jmx (2)
- c++ (3)
- html、js、JSP (1)
- mysql (1)
- redis (1)
- 架构 (1)
最新评论
-
onlyor:
灰太狼1991 写道很受用,请教一下博主,mybatis模糊查 ...
MyBatis模糊查询 -
灰太狼1991:
很受用,请教一下博主,mybatis模糊查询是不是和版本也有关 ...
MyBatis模糊查询 -
zzgvictory:
你写的么,很美啊
js 画 玫瑰花 -
onlyor:
里面的算法值得研究啊
js 画 玫瑰花 -
bjqincy:
用 org.joda System.out.println(& ...
Java 获取 一个月有多少周
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"
default-lazy-init="true">
<!-- JOTM 数据源
<bean id="jotm" class="com.demo.spring.jotm.jta.JotmFactoryBean" />
<bean id="springTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="userTransaction" ref="jotm" />
</bean>
<bean id="myDataSource1" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource">
<property name="dataSource">
<bean class="org.enhydra.jdbc.standard.StandardXADataSource">
<property name="transactionManager">
<ref local="jotm" />
</property>
<property name="driverName">
<value>org.postgresql.Driver</value>
</property>
<property name="url">
<value>jdbc:postgresql://127.0.0.1:5432/test</value>
</property>
</bean>
</property>
<property name="user">
<value>postgres</value>
</property>
<property name="password">
<value>root</value>
</property>
<property name="maxSize">
<value>5</value>
</property>
<property name="minSize">
<value>2</value>
</property>
</bean>
<bean id="myDataSource2" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource">
<property name="dataSource">
<bean class="org.enhydra.jdbc.standard.StandardXADataSource">
<property name="transactionManager">
<ref local="jotm" />
</property>
<property name="driverName">
<value>org.postgresql.Driver</value>
</property>
<property name="url">
<value>jdbc:postgresql://127.0.0.1:5432/news</value>
</property>
</bean>
</property>
<property name="user">
<value>postgres</value>
</property>
<property name="password">
<value>root</value>
</property>
<property name="maxSize">
<value>5</value>
</property>
<property name="minSize">
<value>2</value>
</property>
</bean>
-->
<!-- ATOMIKOS mysql 数据源
<bean id="myDataSource1" class="com.atomikos.jdbc.AtomikosDataSourceBean">
<property name="uniqueResourceName">
<value>MYSQL/test</value>
</property>
<property name="xaDataSourceClassName">
<value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</value>
</property>
<property name="xaProperties">
<props>
<prop key="user">root</prop>
<prop key="password">root</prop>
<prop key="URL">jdbc:mysql://127.0.0.1:3306/test</prop>
</props>
</property>
</bean>
<bean id="myDataSource2" class="com.atomikos.jdbc.AtomikosDataSourceBean">
<property name="uniqueResourceName">
<value>MYSQL/news</value>
</property>
<property name="xaDataSourceClassName">
<value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</value>
</property>
<property name="xaProperties">
<props>
<prop key="user">root</prop>
<prop key="password">root</prop>
<prop key="URL">jdbc:mysql://127.0.0.1:3306/news</prop>
</props>
</property>
</bean>
-->
<!-- ATOMIKOS postgres 数据源 -->
<bean id="myDataSource1" class="com.atomikos.jdbc.AtomikosDataSourceBean">
<property name="uniqueResourceName">
<value>postgre/test</value>
</property>
<property name="xaDataSourceClassName">
<value>org.postgresql.xa.PGXADataSource</value>
</property>
<property name="xaProperties">
<props>
<prop key="user">postgres</prop>
<prop key="password">root</prop>
<prop key="databaseName">test</prop>
<prop key="serverName">127.0.0.1</prop>
<prop key="portNumber">5432</prop>
</props>
</property>
</bean>
<bean id="myDataSource2" class="com.atomikos.jdbc.AtomikosDataSourceBean">
<property name="uniqueResourceName">
<value>postgre/news</value>
</property>
<property name="xaDataSourceClassName">
<value>org.postgresql.xa.PGXADataSource</value>
</property>
<property name="xaProperties">
<props>
<prop key="user">postgres</prop>
<prop key="password">root</prop>
<prop key="databaseName">news</prop>
<prop key="serverName">127.0.0.1</prop>
<prop key="portNumber">5432</prop>
</props>
</property>
</bean>
<bean id="sqlSessionFactory1" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="classpath:config1.xml" />
<property name="dataSource" ref="myDataSource1" />
</bean>
<bean id="sqlSessionFactory2" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="classpath:config2.xml" />
<property name="dataSource" ref="myDataSource2" />
</bean>
<bean id="userDAO" class="com.anxin.dao.impl.UserDAOImpl">
<property name="sqlSessionFactory" ref="sqlSessionFactory1" />
</bean>
<bean id="studentDAO" class="com.anxin.dao.impl.StudentDAOImpl">
<property name="sqlSessionFactory" ref="sqlSessionFactory2" />
</bean>
<bean id="studentService" class="com.anxin.service.impl.StudentServiceImpl">
<property name="dao" ref="studentDAO" />
</bean>
<bean id="userService" class="com.anxin.service.impl.UserServiceImpl">
<property name="dao" ref="userDAO" />
</bean>
<bean id="complexService" class="com.anxin.service.impl.ComplexServiceImpl">
<property name="userDao" ref="userDAO" />
<property name="studentDao" ref="studentDAO" />
</bean>
<!-- atomikosTransactionManager -->
<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</value>
</property>
</bean>
<bean id="springTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager">
<ref bean="atomikosTransactionManager" />
</property>
<property name="userTransaction">
<ref bean="atomikosUserTransaction" />
</property>
</bean>
<aop:config>
<aop:pointcut id="pc" expression="execution(* com.anxin.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="pc" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="springTransactionManager">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="find*" propagation="REQUIRED" read-only="true" />
<tx:method name="has*" propagation="REQUIRED" read-only="true" />
<tx:method name="locate*" propagation="REQUIRED" read-only="true" />
<tx:method name="*" propagation="REQUIRED" rollback-for="Exception" />
</tx:attributes>
</tx:advice>
<!-- 手动代理
<bean id="transactionProxyFactoryBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager">
<ref bean="springTransactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED,-Exception</prop>
</props>
</property>
</bean>
<bean id="complexServiceProxy" parent="transactionProxyFactoryBean">
<property name="target">
<ref bean="complexService" />
</property>
</bean>
-->
</beans>
- jta.jar (17 KB)
- 下载次数: 28
发表评论
-
多线程之Java线程阻塞与唤醒
2017-08-15 01:38 498线程的阻塞和唤醒在多线程并发过程中是一个关键点,当线程数量达 ... -
diffcount 代码差异统计工具
2016-08-12 18:11 1508使用diffcount,可以直接统计前后两个工程中,增加、 ... -
solr5 配置 与 创建core
2015-12-31 09:49 33811. 准备安装包(保证tomat能正常启动) so ... -
HTTP访问的两种方式(HttpClient和HttpURLConnection)
2015-12-30 11:58 2825直接上代码 使用HttpClient Name ... -
maven 使用slf4j与logback结合
2015-10-31 21:10 1349<dependency> & ... -
WAS性能优化分析工具
2015-10-23 14:40 716WAS性能优化分析工具被分析的文件heapdump165490 ... -
异常分类使用
2015-05-04 16:23 552异常分类使用 1.RuntimeException, ... -
一个java枚举的实例
2015-05-04 16:20 670一个java枚举的实例,直接上代码。 /** * ... -
java枚举实例
2015-05-04 16:18 463直接上代码 /** * * 〈枚举测试〉& ... -
POI excel 单元个的内容 自适应行高
2014-12-05 11:03 16783POI excel 单元个的内容 自适应行高 pub ... -
POI的一些操作 获取、删除区域Region 删除多行
2014-12-04 17:02 34921 通过行列获取区域 /** * 获取区域 ... -
Java 排序(转)
2014-11-27 13:51 684排序 public class Sort { ... -
log4j.properties
2014-11-27 13:26 849log4j.rootLogger=DEBUG,CONSOLE, ... -
corba,ejb ,webservice,rest分布式 区别
2014-09-30 11:04 944Corba,还是EJB,都有一些共同点:1) 通过专有的网络协 ... -
JAVA注解总结
2014-09-25 10:21 630最近打算搞清楚以下问题:1. 注解的原理与使用 2. Ja ... -
在同一个类中,线程资源竞争
2014-09-02 08:55 922/** * 在同一个类中,线程资源竞争 ... -
linux下Java字体乱码(解决图像中中文乱码)
2014-08-12 16:27 23685在Java中可以使用如下判断支持的字体 GraphicsE ... -
DBCP 数据源 下载jar包
2014-08-01 13:36 2443一.DBCP 是 Apache 软件基金组织下的开源连接池 ... -
RMI 实例
2014-06-05 09:39 455RMI 实例 package rmi.train; ... -
基于httpclient-4.3 和 4.1的编写小例子
2014-05-29 19:45 1962基于httpclient-4.3 和 4.1的编写小例子 ...
相关推荐
spring+mybatis+atomikos配置文件及相关包
spring+mybatis+atomikos配置文件及相关包
spring+mybatis+atomikos配置所需包跟配置文件
spring+mybatis+atomikos配置文件及相关包.rar
springboot+mybatis+jta+atomikos解决多数据源事务问题
本用例基于 Spring Boot + Druid + Mybatis 配置多数据源,并采用 JTA 实现分布式事务。
NULL 博文链接:https://lizhao6210-126-com.iteye.com/blog/1958831
NULL 博文链接:https://injavawetrust.iteye.com/blog/2308552
Spring Boot:mybatis-plus + atomikos + druid 实现不同实例数据库的多数据源配置和分布式事务管理(demo项目),想到工作上可能会用到多数据源,但是自己在这方面并不是很熟悉,于是在网上查阅了很多文章,结果...
Spring+Mybatis+Atomikos实现JAVA初始化并控制多个数据源+分布式事务的一个DEMO,内涵源代码,以及一篇关于该内容的博客
spring mybatis atomikos 分布式事务 自己写的小demo 包含依赖包
分布式事务操作之Spring+JTA+mybatis源码
后端基于springmybatis的微信小程序商城后端基于springmybatis的微信小程序商城后端基于springmybatis的微信小程序商城后端基于springmybatis的微信小程序商城后端基于springmybatis的微信小程序商城后端基于spring...
SpringMVC Spring MyBatis 框架整合需要的jar包 配置文件 工具类
springmvc + spring + mybatis + maven整合配置文件
SpringBoot集成Atomikos使用Oracle数据库mybatisSpringBoot集成Atomikos使用Oracle数据库mybatisSpringBoot集成Atomikos使用Oracle数据库mybatisSpringBoot集成Atomikos使用Oracle数据库mybatis
开发工具:MyEclipse10, 数据库:Mysql, demo中使用了2个数据源,2个不同的Mysql数据库。 注:不同数据库dataSource的配置是不一样的
Struts2SpringMybatis 增删改查,里面的Struts2,spring,Mybatis配置文件都是模块化的管理,实现了社会版本的配置,不再是个人玩弄的小项目。具体的 sql语句也已经加到了WEBRROT目录下面了,自己下载下来可以详细看...
开发工具:MyEclipse10 数据库:DB2,Mysql demo中使用了2个数据源,1个DB2数据库,1个Mysql数据库。 注:不同数据库dataSource的配置是不一样的