@@ -13,8 +20,16 @@ import org.springframework.stereotype.Controller;
* @author www.byteblogs.com
* @since 2022-03-24
*/
-@Controller
+@RestController
@RequestMapping("/student")
public class StudentController {
+ @Autowired
+ private TestExistsTransactionalRetryService testExistsTransactionalRetryService;
+
+ @GetMapping("query")
+ @OriginalControllerReturnValue
+ public String get() {
+ return testExistsTransactionalRetryService.testSimpleInsert(UUID.randomUUID().toString());
+ }
}
diff --git a/example/src/main/java/com/example/controller/TeacherController.java b/example/src/main/java/com/example/controller/TeacherController.java
index 8cddf95ad..fd6f304d6 100644
--- a/example/src/main/java/com/example/controller/TeacherController.java
+++ b/example/src/main/java/com/example/controller/TeacherController.java
@@ -38,7 +38,7 @@ public class TeacherController {
}
@GetMapping("test-status-code")
- @Retryable(scene = "testStatusCode")
+ @Retryable(scene = "testStatusCode", isThrowException = false)
public Result testStatusCode() {
Result result = restTemplate.getForObject("http://127.0.0.1:8088/school/id", Result.class);
diff --git a/example/src/main/java/com/example/demo/NestMethodService.java b/example/src/main/java/com/example/demo/NestMethodService.java
index c80829d9c..6fa3d8372 100644
--- a/example/src/main/java/com/example/demo/NestMethodService.java
+++ b/example/src/main/java/com/example/demo/NestMethodService.java
@@ -17,7 +17,7 @@ public class NestMethodService {
@Autowired
private TestExistsTransactionalRetryService testExistsTransactionalRetryService;
- @Retryable(scene = "testNestMethod")
+ @Retryable(scene = "testNestMethod" , isThrowException = false)
@Transactional
public void testNestMethod() {
testExistsTransactionalRetryService.testSimpleInsert(UUID.randomUUID().toString());
diff --git a/example/src/test/java/com/example/ExistsTransactionalRetryServiceTest.java b/example/src/test/java/com/example/ExistsTransactionalRetryServiceTest.java
index 6d91466e7..24eba4785 100644
--- a/example/src/test/java/com/example/ExistsTransactionalRetryServiceTest.java
+++ b/example/src/test/java/com/example/ExistsTransactionalRetryServiceTest.java
@@ -39,7 +39,7 @@ public class ExistsTransactionalRetryServiceTest {
Mockito.when(remoteService.call())
.thenReturn(new Result(0, "1"))
.thenReturn(new Result(0, "2"))
- .thenReturn(new Result(1, "3"))
+ .thenReturn(new Result(0, "3"))
.thenReturn(new Result(0, "4"))
.thenReturn(new Result(0, "5"))
;
diff --git a/pom.xml b/pom.xml
index 513042a2f..4c7426d46 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@