结果使用spring数据JPA异步查询

问题描述 投票:1回答:1

我有一个问题,我正在使用spring boot 1.5.9.RELEASE和Spring数据JPA和Hibernate。

我的疑问就像

@Async
CompletableFuture<User> findById(final long id);

我的问题是,如果id不在数据库中,我会得到什么结果?一个CompletableFuture.completedFuture(null)或者直接为null?

提前致谢 !。

java spring asynchronous spring-boot spring-data-jpa
1个回答
0
投票

你将有一个内部为null的CompletableFuture<User>

根据经验,任何spring数据jpa async repo调用本身都不会为null。

© www.soinside.com 2019 - 2024. All rights reserved.