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: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配置事物控制的更多相关文章
- Spring转账业务_注解配置事物控制
1.beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="h ...
- spring整合mybatis的事物管理配置
一.基本配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http:/ ...
- Spring事物管理--相关要点及配置事物管理器
事务的四大特征 1.原子性:一个事务中所有对数据库的操作是一个不可分割的操作序列,要么全做要么全不做 2.一致性:数据不会因为事务的执行而遭到破坏 3.隔离性:一个事物的执行,不受其他事务的干扰,即并 ...
- Spring的5种事物配置方式
Spring事务配置的五种方式 前段时间对Spring的事务配置做了比较深入的研究,在此之间对Spring的事务配置虽说也配置过,但是一直没有一个清楚的认识.通过这次的学习发觉Spring的事务配置只 ...
- 工作流activiti-02事物控制、流程引擎创建
使用activiti中有个很重要的问题就是需要保证事物的控制 activiti使用的是mybatis作为orm技术 封装了一系列的操作数据库操作 这也就是大家调用的api 操作的数据库表都是acti ...
- 【shiro】2.spring整合shiro,注解控制shiro用户/角色/权限And/OR,没有权限跳转到固定页面
这几天粗浅的把shiro整合到spring中,并且注解控制shiro用户/角色/权限And/OR 步骤: 1.首先maven搭建web项目 2.创建数据库 user/role/authority 其中 ...
- spring 实现事务配置的方式
spring 中常用的两种事务配置方式以及事务的传播性.隔离级别 一.注解式事务 1.注解式事务在平时的开发中使用的挺多,工作的两个公司中看到很多项目使用了这种方式,下面看看具体的配置demo. 2. ...
- Spring事务的配置、参数详情及其原理介绍(Transactional)
Spring 事务管理分为编程式和声明式的两种方式.编程式事务指的是通过编码方式实现事务:声明式事务基于 AOP,将具体业务逻辑与事务处理解耦.声明式事务管理使业务代码逻辑不受污染, 因此在实际使用中 ...
- Spring的定时任务配置2(转)
spring的定时任务配置分为三个步骤: 1.定义任务 2.任务执行策略配置 3.启动任务 1.定义任务 <!--要定时执行的方法--> <bean id="testTas ...
随机推荐
- Funq之Lambda表达式入门
今天接受了一个Tranning关于.net3.5 framework中的new feature. 其中最不明白的还是Lambda表达式.回来后又仔细的思考了一番,总算有点体会在这里写一下.既然是入门, ...
- iOS 关于自动更新的分阶段发布(灰度发布)的相关简介
前言: AppStore 发布应用方式除了自动和手动,如今添加了分阶段发布(灰度发布).目的很明确,降低新版本骤然上升的bug率,不能挽回,只能发布新版本的风险.也也是针对禁止使用热修复,推出的相对 ...
- MySQL运维问题集锦
1.莫名的慢查询问题.解决思路:http://hidba.org/?spm=5176.153233.793262.6.d75LDx&p=1119
- LVS/DR 配置
LVS/DR 配置 实验环境 三台主机:Linux Centos 6.4 32位 调度器Director:192.168.1.160(公网IP).192.168.1.100(VIP) HTTP真实服务 ...
- MySQL几个重要的目录
MySQL几个重要的目录 1 数据库目录 /var/lib/mysql/ 2 配置文件 /usr/share/mysql(mysql.server命令及配置文件) 3 相关命令 /usr/bin(my ...
- Django源码剖析
一.Django底层剖析之一次请求到响应的整个流程 As we all know,所有的Web应用,其本质上其实就是一个socket服务端,而用户的浏览器就是一个socket客户端 #!/usr/bi ...
- Qt下TCP编程
一.服务器 1.声明一个QTcpServer对象 QTcpServer* serverListener; 2.new出对象 this->serverListener = new QTcpServ ...
- Docker 数据收集利器:cadvisor
gitHub地址:https://github.com/google/cadvisor cAdvisor cAdvisor (Container Advisor) provides container ...
- relativePath
比如: com.tenace tenace 2.0.1 ../pom.xml //刚开始无此句 com.spider engine 2.6.0-SNAPSHOT tenace作为pom项目已经发布至r ...
- 泛型学习第一天:List与IList的区别 (二)
原文: 探讨Ilist<>与List<> 首先要了解一点的是关于接口的基础知识: 接口不能直接实例化但是接口派生出来的抽象类可以实例化所有派生出来的抽象类都可以强制转换成接口的 ...