最近有朋友问到spring中事务的配置,以下就是比较常见的配置
配置文件如下:
<?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: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.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd ">
这些才是最关键的地方。。后面的配置不变。。。。
Spring使用 <tx:advice>和 <aop:config> 用来配置事务,具体如何配置你可以参考Spring文档。
我解释一下(* com.evan.crm.service.*.*(..))中几个通配符的含义:
第一个 * —— 通配 任意返回值类型
第二个 * —— 通配 包com.evan.crm.service下的任意class
第三个 * —— 通配 包com.evan.crm.service下的任意class的任意方法
第四个 .. —— 通配 方法可以有0个或多个参数
综上:包com.evan.crm.service下的任意class的具有任意返回值类型、任意数目参数和任意名称的方法
分享到:
相关推荐
包含spring事务管理案例的项目源码和说明文档
此ppt中前半部分通过spring事务的60道题的测试,摸底对事务的掌握情况,后半部分,对spring中的事务属性(传播行为、隔离级别、回滚规则、事务超时、是否只读)进行说明
Spring Hibernate 事务处理 详细说明 Spring Hibernate 事务处理 详细说明
详细说明spring事务配置的5种方式 让你对spring 有更深入的认识
可以在spring中对整个项目的事务进行控制
spring的事务处理的详细说明和解析,事务的传播和使用的方式
Spring,Bean调用,事务,AOP,配置详细说明 提升开发效率
spring使用注解进行事物管理例子,里面有说明.
spring 五种事务的配置说明 请大家共享
struts2、spring与mybatis整合 包含简单登录功能 事务配置,运行JunitTestVillageArticle的modify测试。配置说明参考注释
csdn博客竟然也出问题,好不容总结一下,竟然发不了博客。依稀csdn! 1、spring与hibernate事务管理 2、aop 3、事务管理,声明式。 3、事务传递特性说明
Spring中的事务控制,内有详细的说明。
软件架构说明 springcloud-common 公共模块 springcloud-order-AT 订单服务 springcloud-product-AT 商品库存服务 springcloud-consumer-AT 消费调用者 springcloud-business-Tcc 工商银行服务 springcloud-...
基于Spring Cloud+Vue的班级事务管理系统源码+详细项目说明.zip 系统架构 项目采用B/S架构,前后端通讯采用RESTful API,数据格式使用Json,认证Token格式采用JWT。 身份认证使用Spring Security Oauth2。 前端:...
一篇很好的springCloud学习的思维导读,详细的介绍了,springCloud的搭建步骤以及各组件的说明讲解 涵盖 Eureka服务注册与发现 Zookeeper服务注册与发现 Consul服务注册与发现 Ribbon负载均衡服务调用 OpenFeign...
Spring包依赖说明: 1) spring-core.jar需commons-collections.jar,spring-core.jar是以下其它各个的基本。 2) spring-beans.jar需spring-core.jar,cglib-nodep-2.1_3.jar 3) spring-aop.jar需spring-core.jar,...
第10章:对实际应用中Spring事务管理各种疑难问题进行透彻的剖析,让读者对Spring事务管理不再有云遮雾罩的感觉。 第11章:讲解了如何使用Spring JDBC进行数据访问操作,我们还重点讲述了LOB字段处理、主键产生...
2.Spring+Jotm整合实现JTA分布式事务,应用场景如转账等,同一事务内完成db1用户加100元、db2用户减100元。 3.Spring+Junit4单元测试,优点:不会破坏数据库现场,等等。 (特别注意:Spring3.0里不在提供对jotm的...
1)、事务增强器要用事务注解的信息,AnnotationTransactionAttributeSource解析事务注解 2)、事务拦截器: TransactionInterceptor;保存了事务属性信息,事务管理器; 他是一个 MethodInterceptor; 在目标...