spring 配置事务xml
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-autowire="byName">
<context:component-scan base-package="com.inborn.inshop" />
<aop:aspectj-autoproxy proxy-target-class="true" />
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
lazy-init="true">
<property name="dataSource" ref="dataSource" />
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="query*" propagation="REQUIRED" read-only="true" />
<tx:method name="save*" propagation="REQUIRED" isolation="REPEATABLE_READ" timeout="6" rollback-for="java.lang.Exception,java.lang.RuntimeException" />
<tx:method name="add*" propagation="REQUIRED" isolation="REPEATABLE_READ" timeout="6" rollback-for="java.lang.Exception,java.lang.RuntimeException" />
<tx:method name="insert*" propagation="REQUIRED" isolation="REPEATABLE_READ" timeout="6" rollback-for="java.lang.Exception,java.lang.RuntimeException" />
<tx:method name="batch*" propagation="REQUIRED" isolation="REPEATABLE_READ" timeout="6" rollback-for="java.lang.Exception,java.lang.RuntimeException" />
<tx:method name="update*" propagation="REQUIRED" isolation="REPEATABLE_READ" timeout="6" rollback-for="java.lang.Exception,java.lang.RuntimeException" />
<tx:method name="del*" propagation="REQUIRED" isolation="REPEATABLE_READ" timeout="6" rollback-for="java.lang.Exception,java.lang.RuntimeException" />
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="service"
expression="execution(* com.inborn.inshop.service..*.*(..))" />
<aop:advisor id="txAdviceAop" advice-ref="txAdvice"
pointcut-ref="service" />
</aop:config>
</beans>
spring 配置事务xml的更多相关文章
- [转]@Transactional spring 配置事务 注意事项
@Transactional spring 配置事务 注意事项 [@more@] @Transactional spring 配置事务 注意事项 1. 在需要事务管理的地方加@Transactiona ...
- Spring配置事务中的 transactionAttributes 各属性含义及XML配置
转自:https://blog.csdn.net/z69183787/article/details/17161393 transactionAttributes 属性: PROPAGATION 事务 ...
- spring框架 事务 xml配置方式
user=LF password=LF jdbcUrl=jdbc:oracle:thin:@localhost:1521:orcl driverClass=oracle.jdbc.driver.Ora ...
- Spring配置事务 http://www.cnblogs.com/leiOOlei/p/3725911.html
http://www.cnblogs.com/leiOOlei/p/3725911.html JNDI方式配置数据源: <?xml version="1.0" encodin ...
- Spring 配置 事务的几种方式
Spring配置文件中关于事务配置总是由三个组成部分,DataSource.TransactionManager和代理机制这三部分,无论是那种配置方法,一般变化的只是代理机制这块! 首先我创建了两个类 ...
- Spring配置事务的五种方式
Java事务的类型有三种: JDBC事务. 可以将多个 SQL 语句结合到一个事务中.JDBC 事务的一个缺点是事务的范围局限于一个数据库连接.一个 JDBC 事务不能跨越多个数据库 JTA(Java ...
- spring 配置事务管理器
在Spring中数据库事务是通过PlatformTransactionManager进行管理的,jdbcTemplate是不能支持事务的,而能够支持事务的是org.springframework.tr ...
- spring配置事务
一.配置JDBC事务处理机制 <!-- 配置Hibernate事务处理 --> <bean id="transactionManager" class=" ...
- 怎么使用Spring配置事务 ?
Spring同时支持编程式事务策略和声明式事务策略,大部分时候都采用声明式事务策略. 声明式事务管理的配置方式,通常有以下4种: (1) 使用TransactionProxyFactoryBean为目 ...
随机推荐
- 【Redis学习之十一】Java客户端实现redis集群操作
客户端:jedis-2.7.2.jar 配置文件两种方式: properties: redis.cluster.nodes1=192.168.1.117 redis.cluster.port1=700 ...
- 直流-直流(DC-DC)变换电路_BUCK&BOOST变换电路
1. 直流—直流变换器通过对电力电子器件的通断控制,将直流电压断续地加到负载上,通过改变占空比改变输出电压平均值. BUCK线路原理图如上,其中Q管/MOS作为开关管,驱动电压一般为PWM. 当开关管 ...
- 转:如何捕获winform程序全局异常?
前言 上篇文章我提供了一种方案可以供我们捕获单线程程序中的所有未处理异常.但是如果程序是多线程,那么新增线程出现了异常上个方案就无能为力了.本着方案总比问题多的态度,我再给大家提供一种新的方案,供大家 ...
- MVC模式、加密、jsonwebtoken
一.MVC模式(架构思想) M:model层,主要是数据的增删改查 V:view层,主要是视图的展示 C:controller层,主要负责业务逻辑 二.加密(md5加密.sha256加密)1.sha2 ...
- The Little Prince-11/30
The Little Prince-11/30 Today, I have a meeting in our department. I sincerely hope that all of my d ...
- sql语句查询结果排序
order by 是用在where条件之后,用来对查询结果进行排序 order by 字段名 asc/desc asc 表示升序(默认为asc,可以省略) desc表示降序 order b ...
- Kattis之旅——Eight Queens
In the game of chess, the queen is a powerful piece. It can attack by moving any number of spaces in ...
- thinkphp 检测验证码
/** * 检测验证码 * @param integer $id 验证码ID * @return boolean 检测结果 */function check_verify($code, $id = 1 ...
- java中线程的停止以及LockSupport工具类
看jstack输出的时候,可以发现很多状态都是TIMED_WAITING(parking),如下所示: "http-bio-8080-exec-16" #70 daemon pri ...
- gitlab服务器迁移
公司更换了新的服务器,需要把原先的gitlab迁移到新的服务器上. 1.迁移准备工作和思路:从a服务器迁移到b服务器,由于Gitlab自身的兼容性问题,高版本的Gitlab无法恢复低版本备份的数据,需 ...