0
点赞
收藏
分享

微信扫一扫

springboot通过CompletableFuture实现多异步任务

天行五煞 2022-02-20 阅读 80
spring boot

1、导入

import java.util.concurrent.CompletableFuture;

2、方法中启用两个线程,分别执行两个同步的update

​

@Override
public byte[] update() throws Exception {

 CompletableFuture.runAsync(() -> update(updateWrapper));
 CompletableFuture.runAsync(() -> cardService.update(updateWrapper1));

}


​

举报

相关推荐

0 条评论