spring事务配置步骤

摘要:
spring事务配置流程第一步:配置事务管理器第二步:配置通知--》传播行为第三步:配置切入点--》切面AOP˂!
spring事务配置流程

第一步:配置事务管理器

spring事务配置步骤第1张

第二步:配置通知--》传播行为

spring事务配置步骤第2张

第三步:配置切入点--》切面 AOP

spring事务配置步骤第3张

<!-- 事务管理器 -->
	<bean  
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<!-- 数据源 -->
		<property name="dataSource" ref="dataSource" />
	</bean>
	<!-- 通知 -->
	<tx:advice   transaction-manager="transactionManager">
		<tx:attributes>
			<!-- 传播行为 -->
			<tx:method name="save*" propagation="REQUIRED" />
			<tx:method name="insert*" propagation="REQUIRED" />
			<tx:method name="add*" propagation="REQUIRED" />
			<tx:method name="create*" propagation="REQUIRED" />
			<tx:method name="delete*" propagation="REQUIRED" />
			<tx:method name="update*" propagation="REQUIRED" />
			<tx:method name="find*" propagation="SUPPORTS" read-only="true" />
			<tx:method name="select*" propagation="SUPPORTS" read-only="true" />
			<tx:method name="get*" propagation="SUPPORTS" read-only="true" />
		</tx:attributes>
	</tx:advice>
	<!-- 切面 -->
	<aop:config>
		<aop:advisor advice-ref="txAdvice"
			pointcut="execution(* com.bobo.service.*.*(..))" />
	</aop:config>

免责声明:文章转载自《spring事务配置步骤》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇vue v-model 的注意点Netty NIO 框架性能压测-短链接-对比Tomcat下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

关于Spring运用过程中jar包报错问题

使用Spring进行web开发时,第一步就是导入jar包,今天使用SPring Task开发定时器时,导入了好多次jar包,都是报错,不知道是因为jar包版本不同还是因为需要依赖的jar包没加入,反正就是怎么着都不行。 后来终于找着全的了。 首先记录一下spring jar包报错的常见bug: org.springframework.beans.facto...

springboot之多数据源配置JdbcTemplate

springboot多数据源配置,代码如下 DataSourceConfig package com.rookie.bigdata.config; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.contex...

3--Redis事务 ;配置文件详解 ;数据持久化

目录 一、事务 1.Redis的事务 2. 监控watch 二、Redis.conf详解 1.配置文件unit单位对大小写不敏感 2.包含 3.网络 4.通用general 5.快照 6.SECURITY安全 7.限制clients 8.append only 模式 aof配置 三、数据持久化 1.Redis数据安全问题 2.快照持久化...

CI框架的事务开启、提交和回滚

1.运行事务 $this->db->trans_start();  // 开启事务$this->db->query('一条SQL查询...');$this->db->query('另一条查询...');$this->db->query('还有一条查询...');$this->db->trans_c...

(4.40)sql server默认连接选项

一、SQLserver 默认连接选项 当我们连接sqlserver数据库时,我们发现Sqlserver Profiler 里面的Audit Login 事件: -- network protocol: TCP/IP 1    set quoted_identifieron 2    set arithabortoff 3    set numeric_ro...

Innodb日志与事务

1.Innodb日志: 错误日志:记录出错信息,也记录一些警告信息或者正确的信息。 查询日志:记录所有对数据库请求的信息,不论这些请求是否得到了正确的执行。 慢查询日志:设置一个阈值,将运行时间超过该值的所有SQL语句都记录到慢查询的日志文件中。 二进制日志:记录对数据库执行更改的所有操作。 中继日志:事务日志: 2.Innodb事务: 1.读未提交(RU...