Skip to content

Commit aec27df

Browse files
committed
modify
1 parent 0f014ce commit aec27df

File tree

1 file changed

+4
-9
lines changed
  • springboot-ac-task/src/main/java/com/lazycece/sbac/task/async

1 file changed

+4
-9
lines changed

springboot-ac-task/src/main/java/com/lazycece/sbac/task/async/AsyncDemo.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ public class AsyncDemo implements CommandLineRunner {
1818

1919
@Resource
2020
private AsyncRun asyncRun;
21-
@Resource
22-
private AsyncFuture asyncFuture;
2321

2422
@Override
2523
public void run(String... args) throws Exception {
2624
System.out.println("begin");
27-
asyncRun.run();
28-
Future<String> future = asyncFuture.run();
25+
asyncRun.async();
26+
Future<String> future = asyncRun.asyncFuture();
2927
System.out.println("end");
3028
System.out.println(future.get(1, TimeUnit.SECONDS));
3129
}
@@ -34,15 +32,12 @@ public void run(String... args) throws Exception {
3432
@Component
3533
class AsyncRun {
3634
@Async
37-
void run() {
35+
void async() {
3836
System.out.println("async running");
3937
}
40-
}
4138

42-
@Component
43-
class AsyncFuture {
4439
@Async
45-
Future<String> run() {
40+
Future<String> asyncFuture() {
4641
System.out.println("async-future running");
4742
return new AsyncResult<>("async-future run");
4843
}

0 commit comments

Comments
 (0)