Spring配置事务切面
来源:互联网 发布:caffe alexnet 编辑:程序博客网 时间:2024/04/30 18:44
第一步:
在Spring配置文件中引用头文件
引用前:
<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
引用后:
<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: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
">
第二步:
配置事务切面
<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<!--注入SessionFactory对象-->
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!--事务传播特性-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<!--配置事务影响的类-->
<aop:config>
<aop:pointcut expression="execution(* com.service.impl.*.*(..))" id="trBiz"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="trBiz"/>
</aop:config>
- Spring配置切面事务
- Spring配置事务切面
- Spring 事务切面配置
- spring 在有事务的方法上配置自定义日志切面,事务会失效解决方法
- spring切面配置
- Spring切面配置
- spring 切面配置
- spring切面(aspect)配置
- Spring配置切面
- spring学习笔记(23)基于tx/aop配置切面增强事务
- spring aop 切面编程控制管理事务
- spring aop事务通知(切面异常处理)
- Spring之配置切面aspect
- spring-aop配置多切面
- 切面语法和事务的xml配置
- 事务配置-基于tx/aop配置切面增强事务
- [Spring3.x源码]事务(一)配置事务切面
- spring中如何将事务添加到切面中
- Android开发_如何调用系统默认浏览器访问
- String方法取字符出现次数和字符最大相同
- crosswalk 屏蔽 窗口最小化(window.close)方法
- jQuery实现文种自动识别标题的最后两个或一个字,判断文种类型,如XXX的通知,文种默认为通知;
- Target runtime com.genuitec.runtime.generic.jee60 is not defined.
- Spring配置事务切面
- iOS百度地图后台持续定位(一)
- 只设置视图的一个或几个角为圆角
- Xcode 下 svn 变更用户名/URL的方法
- 快速排序算法
- 第7章 鼠标
- iOS内购详细教程 从0到1
- 冒泡排序(bubbleSort)
- php 常见的内置函数及用法