mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-06-20 22:17:09 +08:00
Update spring-knowledge-and-questions-summary.md
This commit is contained in:
parent
cef4d6a67b
commit
26de5441d5
@ -555,8 +555,8 @@ public class GlobalExceptionHandler {
|
||||
|
||||
### Spring 管理事务的方式有几种?
|
||||
|
||||
- **编程式事务**:在代码中硬编码(不推荐使用) : 通过 `TransactionTemplate`或者 `TransactionManager` 手动管理事务,实际应用中很少使用,但是对于你理解 Spring 事务管理原理有帮助。
|
||||
- **声明式事务**:在 XML 配置文件中配置或者直接基于注解(推荐使用) : 实际是通过 AOP 实现(基于`@Transactional` 的全注解方式使用最多)
|
||||
- **编程式事务**:在代码中硬编码(在分布式系统中推荐使用) : 通过 `TransactionTemplate`或者 `TransactionManager` 手动管理事务,事务范围过大会出现事务未提交导致超时,因此事务要比锁的粒度更小。
|
||||
- **声明式事务**:在 XML 配置文件中配置或者直接基于注解(单体应用或者简单业务系统推荐使用) : 实际是通过 AOP 实现(基于`@Transactional` 的全注解方式使用最多)
|
||||
|
||||
### Spring 事务中哪几种事务传播行为?
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user