没有合适的资源?快使用搜索试试~ 我知道了~
首页Spring中@Transactional用法详细介绍
Spring中@Transactional用法详细介绍
5星 · 超过95%的资源 5 下载量 89 浏览量
更新于2023-03-16
收藏 76KB PDF 举报
主要介绍了Spring中@Transactional用法详细介绍的相关资料,需要的朋友可以参考下
资源详情
资源推荐
Spring中中@Transactional用法详细介绍用法详细介绍
主要介绍了Spring中@Transactional用法详细介绍的相关资料,需要的朋友可以参考下
Spring中中@Transactional用法详细介绍用法详细介绍
引言: 在spring中@Transactional提供一种控制事务管理的快捷手段,但是很多人都只是@Transactional简单使用,并未深入
了解,其各个配置项的使用方法,本文将深入讲解各个配置项的使用。
1. @Transactional的定义的定义
Spring中的@Transactional基于动态代理的机制,提供了一种透明的事务管理机制,方便快捷解决在开发中碰到的问题。在
现实中,实际的问题往往比我们预期的要复杂很多,这就要求对@Transactional有深入的了解,以来应对复杂问题。
首先我们来看看@Transactional的代码定义:
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface Transactional {
/**
* A qualifier value for the specified transaction.
* <p>May be used to determine the target transaction manager,
* matching the qualifier value (or the bean name) of a specific
* {@link org.springframework.transaction.PlatformTransactionManager}
* bean definition.
*/
String value() default "";
/**
* The transaction propagation type.
* Defaults to {@link Propagation#REQUIRED}.
* @see org.springframework.transaction.interceptor.TransactionAttribute#getPropagationBehavior()
*/
Propagation propagation() default Propagation.REQUIRED;
/**
* The transaction isolation level.
* Defaults to {@link Isolation#DEFAULT}.
* @see org.springframework.transaction.interceptor.TransactionAttribute#getIsolationLevel()
*/
Isolation isolation() default Isolation.DEFAULT;
/**
* The timeout for this transaction.
* Defaults to the default timeout of the underlying transaction system.
* @see org.springframework.transaction.interceptor.TransactionAttribute#getTimeout()
*/
int timeout() default TransactionDefinition.TIMEOUT_DEFAULT;
/**
* {@code true} if the transaction is read-only.
* Defaults to {@code false}.
* <p>This just serves as a hint for the actual transaction subsystem;
* it will <i>not necessarily</i> cause failure of write access attempts.
* A transaction manager which cannot interpret the read-only hint will
* <i>not</i> throw an exception when asked for a read-only transaction.
* @see org.springframework.transaction.interceptor.TransactionAttribute#isReadOnly()
*/
boolean readOnly() default false;
/**
* Defines zero (0) or more exception {@link Class classes}, which must be a
* subclass of {@link Throwable}, indicating which exception types must cause
* a transaction rollback.
* <p>This is the preferred way to construct a rollback rule, matching the
* exception class and subclasses.
* <p>Similar to {@link org.springframework.transaction.interceptor.RollbackRuleAttribute#RollbackRuleAttribute(Class clazz)}
*/
Class<? extends Throwable>[] rollbackFor() default {};
/**
* Defines zero (0) or more exception names (for exceptions which must be a
* subclass of {@link Throwable}), indicating which exception types must cause
* a transaction rollback.
* <p>This can be a substring, with no wildcard support at present.
weixin_38614377
- 粉丝: 2
- 资源: 945
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 新皇冠假日酒店互动系统的的软件测试论文.docx
- 上海空中营业厅系统的软件测试论文.doc
- 网上选课系统的设计与实现论文.doc
- 师生互动网站设计与实现 ()论文.doc
- 学生档案管理系统论文_正文.doc
- 视频会议系统的设计与实现毕业论文.docx
- 基于web的职工电子档案管理系统的设计与实现毕业论文.docx
- 考试辅导网站的设计与实现论文.doc
- 论文 云端图书馆管理系统设计与实现.docx
- 计算机等级考试网上辅导系统的设计与实现论文.doc
- 基于web烘焙坊网站的设计与实现论文.doc
- 论文_基于J2EE的高校后勤采供管理系统开发.docx
- 老龄化社区服务及其系统应用论文.doc
- 论文-java基于SSM的大学生创新创业信息系统.docx
- 猎豹安全浏览器的软件测试论文.doc
- 基于Web的网上书店系统的设计与实现毕业论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功