Skip to content

Commit 981cb98

Browse files
committed
🏗️ 👥 ⚡
1 parent 2ec186e commit 981cb98

File tree

1 file changed

+11
-2
lines changed
  • springboot3.0/springboot335/src/main/java/com/springboot335/springboot335/service

1 file changed

+11
-2
lines changed

springboot3.0/springboot335/src/main/java/com/springboot335/springboot335/service/TestServiceImpl.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package com.springboot335.springboot335.service;
22

3+
import org.springframework.retry.annotation.Backoff;
34
import org.springframework.retry.annotation.Retryable;
45
import org.springframework.stereotype.Service;
56

7+
import java.time.LocalDateTime;
8+
import java.time.ZoneId;
9+
import java.time.format.DateTimeFormatter;
10+
611

712
/**
813
* 注解说明
@@ -20,11 +25,15 @@
2025

2126

2227
@Service
23-
@Retryable(value = Exception.class)
28+
@Retryable(
29+
value = Exception.class,
30+
backoff = @Backoff(delay = 1000, multiplier = 2)
31+
)
2432
public class TestServiceImpl implements TestService {
2533
@Override
2634
public String testGet(Integer id) {
27-
System.out.println("id = " + id);
35+
String time = LocalDateTime.now(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
36+
System.out.println("time=" + time + " " + "id = " + id);
2837
Integer.valueOf("a");
2938
return "get " + id;
3039
}

0 commit comments

Comments
 (0)