<?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-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/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <!-- 扫描包基础目录 -->
<context:component-scan base-package="com.wisezone"></context:component-scan> <!-- 加载properties 配置文件 -->
<context:property-placeholder location="db.properties"/> <!-- c3p0数据源配置 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${driver}"></property>
<property name="jdbcUrl" value="${url}"></property>
<property name="user" value="${user}"></property>
<property name="password" value="${password}"></property>
</bean> <!-- jdbc模板类配置 -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<!-- 属性名称固定 -->
<property name="dataSource" ref="dataSource"></property>
</bean> <aop:aspectj-autoproxy/> <!-- 事物管理器配置 -->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean> <!-- 配置事物通知 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice> <!-- 切面配置 -->
<aop:config>
<!-- ..:表示service下所有子包 (..):表示拦截的东西 -->
<aop:pointcut expression="execution (* com.wisezone.service..*.*(..))" id="cut"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="cut"/>
</aop:config>
</beans>

Spring转账业务_XML配置事物控制的更多相关文章

  1. Spring转账业务_注解配置事物控制

    1.beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="h ...

  2. spring整合mybatis的事物管理配置

    一.基本配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http:/ ...

  3. Spring事物管理--相关要点及配置事物管理器

    事务的四大特征 1.原子性:一个事务中所有对数据库的操作是一个不可分割的操作序列,要么全做要么全不做 2.一致性:数据不会因为事务的执行而遭到破坏 3.隔离性:一个事物的执行,不受其他事务的干扰,即并 ...

  4. Spring的5种事物配置方式

    Spring事务配置的五种方式 前段时间对Spring的事务配置做了比较深入的研究,在此之间对Spring的事务配置虽说也配置过,但是一直没有一个清楚的认识.通过这次的学习发觉Spring的事务配置只 ...

  5. 工作流activiti-02事物控制、流程引擎创建

    使用activiti中有个很重要的问题就是需要保证事物的控制 activiti使用的是mybatis作为orm技术 封装了一系列的操作数据库操作  这也就是大家调用的api 操作的数据库表都是acti ...

  6. 【shiro】2.spring整合shiro,注解控制shiro用户/角色/权限And/OR,没有权限跳转到固定页面

    这几天粗浅的把shiro整合到spring中,并且注解控制shiro用户/角色/权限And/OR 步骤: 1.首先maven搭建web项目 2.创建数据库 user/role/authority 其中 ...

  7. spring 实现事务配置的方式

    spring 中常用的两种事务配置方式以及事务的传播性.隔离级别 一.注解式事务 1.注解式事务在平时的开发中使用的挺多,工作的两个公司中看到很多项目使用了这种方式,下面看看具体的配置demo. 2. ...

  8. Spring事务的配置、参数详情及其原理介绍(Transactional)

    Spring 事务管理分为编程式和声明式的两种方式.编程式事务指的是通过编码方式实现事务:声明式事务基于 AOP,将具体业务逻辑与事务处理解耦.声明式事务管理使业务代码逻辑不受污染, 因此在实际使用中 ...

  9. Spring的定时任务配置2(转)

    spring的定时任务配置分为三个步骤: 1.定义任务 2.任务执行策略配置 3.启动任务 1.定义任务 <!--要定时执行的方法--> <bean id="testTas ...

随机推荐

  1. foreach使用和函数

    2016-04-25 一.foreach( 对集合每个元素的引用 in 集合 ) { } int[] a = new int[5]{1,2,3,4,5}; foreach( int b in a ) ...

  2. Android:日常学习笔记(8)———探究UI开发(5)

    Android:日常学习笔记(8)———探究UI开发(5) ListView控件的使用 ListView概述 A view that shows items in a vertically scrol ...

  3. junit在idea中的使用(1)--理论篇

     感觉本文前部分配置太过繁琐,大家可以参考我的这篇文章http://www.cnblogs.com/SuMeng/p/8279879.html(junit在IDEA中使用--实践篇),用添加maven ...

  4. Vuex 原理

    1.Vuex是什么? 学院派:Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式:集中存储和管理应用的所有组件状态. 理解:以上这4个词是我们理解的关键.状态:什么是状态,我们可以通俗的理 ...

  5. mysql case的语法

    测试表:team 第一种语法: CASE case_value WHEN when_value THEN statement_list [WHEN when_value THEN statement_ ...

  6. tcp/ip 中的分组和分片

    osi 大家应该都知道osi七层模型吧,物理层 链路层 网络层 传输层 会话层 表示层 应用层ip 属于网络层,tcp 属于传输层,你可以把每一层想像成粽子的粽叶,包裹了七层的粽子最外面的就是物理层, ...

  7. MongoDB命令语法小用

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using MongoDB; ...

  8. @MarkFan 口语练习录音 20140401

    Hi,everybody 对于未来,我只梦想最好的情况, 并定下最踏实的计划,而绝不花时间在无谓的担心上, 因为我知道,只要把我对自己的承诺付诸实践, 我的未来将不会只是一个梦…… 这是引用考拉小巫的 ...

  9. jq中ajax的dataType:"json"是指什么?

    dataType String 预期服务器返回的数据类型.如果不指定,jQuery 将自动根据 HTTP 包 MIME 信息来智能判断,比如XML MIME类型就被识别为XML.在1.4中,JSON就 ...

  10. java写出图形界面

    1. 做出简单的窗体 package javaGUI; import java.awt.BorderLayout; import java.awt.Color; import javax.swing. ...