1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

Fix [Spring 事务总结] spring-transaction.md 中Propagation 写法错误

This commit is contained in:
lcan520 2022-04-12 09:31:32 +08:00
parent 9db4b43768
commit 1b64d2a48c

View File

@ -127,7 +127,7 @@ public void testTransaction() {
使用 `@Transactional`注解进行事务管理的示例代码如下: 使用 `@Transactional`注解进行事务管理的示例代码如下:
```java ```java
@Transactional(propagation=propagation.PROPAGATION_REQUIRED) @Transactional(propagation = Propagation.REQUIRED)
public void aMethod { public void aMethod {
//do something //do something
B b = new B(); B b = new B();
@ -277,7 +277,7 @@ public interface TransactionStatus{
```java ```java
Class A { Class A {
@Transactional(propagation=propagation.xxx) @Transactional(propagation = Propagation.xxx)
public void aMethod { public void aMethod {
//do something //do something
B b = new B(); B b = new B();
@ -286,7 +286,7 @@ Class A {
} }
Class B { Class B {
@Transactional(propagation=propagation.xxx) @Transactional(propagation = Propagation.xxx)
public void bMethod { public void bMethod {
//do something //do something
} }
@ -358,7 +358,7 @@ public enum Propagation {
```java ```java
Class A { Class A {
@Transactional(propagation=propagation.PROPAGATION_REQUIRED) @Transactional(propagation = Propagation.REQUIRED)
public void aMethod { public void aMethod {
//do something //do something
B b = new B(); B b = new B();
@ -367,7 +367,7 @@ Class A {
} }
Class B { Class B {
@Transactional(propagation=propagation.PROPAGATION_REQUIRED) @Transactional(propagation = Propagation.REQUIRED)
public void bMethod { public void bMethod {
//do something //do something
} }
@ -382,7 +382,7 @@ Class B {
```java ```java
Class A { Class A {
@Transactional(propagation=propagation.PROPAGATION_REQUIRED) @Transactional(propagation = Propagation.REQUIRED)
public void aMethod { public void aMethod {
//do something //do something
B b = new B(); B b = new B();
@ -391,7 +391,7 @@ Class A {
} }
Class B { Class B {
@Transactional(propagation=propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public void bMethod { public void bMethod {
//do something //do something
} }
@ -409,7 +409,7 @@ Class B {
```java ```java
Class A { Class A {
@Transactional(propagation=propagation.PROPAGATION_REQUIRED) @Transactional(propagation = Propagation.REQUIRED)
public void aMethod { public void aMethod {
//do something //do something
B b = new B(); B b = new B();
@ -418,7 +418,7 @@ Class A {
} }
Class B { Class B {
@Transactional(propagation=propagation.PROPAGATION_NESTED) @Transactional(propagation = Propagation.NESTED)
public void bMethod { public void bMethod {
//do something //do something
} }