File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
springboot-ac-task/src/main/java/com/lazycece/sbac/task/async Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff 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
3533class 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 }
You can’t perform that action at this time.
0 commit comments