<?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的更多相关文章

  1. [转]@Transactional spring 配置事务 注意事项

    @Transactional spring 配置事务 注意事项 [@more@] @Transactional spring 配置事务 注意事项 1. 在需要事务管理的地方加@Transactiona ...

  2. Spring配置事务中的 transactionAttributes 各属性含义及XML配置

    转自:https://blog.csdn.net/z69183787/article/details/17161393 transactionAttributes 属性: PROPAGATION 事务 ...

  3. spring框架 事务 xml配置方式

    user=LF password=LF jdbcUrl=jdbc:oracle:thin:@localhost:1521:orcl driverClass=oracle.jdbc.driver.Ora ...

  4. Spring配置事务 http://www.cnblogs.com/leiOOlei/p/3725911.html

    http://www.cnblogs.com/leiOOlei/p/3725911.html JNDI方式配置数据源: <?xml version="1.0" encodin ...

  5. Spring 配置 事务的几种方式

    Spring配置文件中关于事务配置总是由三个组成部分,DataSource.TransactionManager和代理机制这三部分,无论是那种配置方法,一般变化的只是代理机制这块! 首先我创建了两个类 ...

  6. Spring配置事务的五种方式

    Java事务的类型有三种: JDBC事务. 可以将多个 SQL 语句结合到一个事务中.JDBC 事务的一个缺点是事务的范围局限于一个数据库连接.一个 JDBC 事务不能跨越多个数据库 JTA(Java ...

  7. spring 配置事务管理器

    在Spring中数据库事务是通过PlatformTransactionManager进行管理的,jdbcTemplate是不能支持事务的,而能够支持事务的是org.springframework.tr ...

  8. spring配置事务

    一.配置JDBC事务处理机制 <!-- 配置Hibernate事务处理 --> <bean id="transactionManager" class=" ...

  9. 怎么使用Spring配置事务 ?

    Spring同时支持编程式事务策略和声明式事务策略,大部分时候都采用声明式事务策略. 声明式事务管理的配置方式,通常有以下4种: (1) 使用TransactionProxyFactoryBean为目 ...

随机推荐

  1. xml 的 <![CDATA["URL"]]>

    <![CDATA["URL"]]>:用于 xml 处理特殊字符,比如:& <PolicyURL><![CDATA[ http://ectp.t ...

  2. 为什么我们要使用HTTP Strict Transport Security?

    http://www.freebuf.com/articles/web/66827.html

  3. mysql查询语句 查询方式

  4. Codeforce 834A - The Useless Toy

    Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kin ...

  5. router.go,router.push,router.replace的区别

    除了使用 <router-link> 创建 a 标签来定义导航链接,我们还可以借助 router 的实例方法,通过编写代码来实现.当你点击 <router-link> 时,这个 ...

  6. linux上限值网速、限值带宽

    Linux操作系统中的流量控制器TC(Traffic Control)用于Linux内核的流量控制,主要是通过在输出端口处建立一个队列来实现流量控制. Linux流量控制的基本原理如下图所示. 接收包 ...

  7. Django框架----模板继承和静态文件配置

    母板 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8& ...

  8. 基于jquery 的dateRangePicker 和 My97DatePicker

    引入相应的date插件 <script type="text/javascript" src="../plugins/daterangepicker/moment. ...

  9. @Entity 和 @Table

    Java Persistence API定义了一种定义,可以将常规的普通Java对象(有时被称作POJO)映射到数据库.这些普通Java对象被称作Entity Bean.除了是用Java Persis ...

  10. pat 团体赛练习题集 L2-006. 树的遍历

    给定一棵二叉树的后序遍历和中序遍历,请你输出其层序遍历的序列.这里假设键值都是互不相等的正整数. 输入格式: 输入第一行给出一个正整数N(<=30),是二叉树中结点的个数.第二行给出其后序遍历序 ...