Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert CompletableFuture to Coroutine

I am a newbie in Kotlin world and would like to know, if it is possible to convert CompletableFuture to Coroutine or how to use togheter.

Why I would like to do that, because all methods of AsyncCrudRepository returns CompletableFuture.

like image 995
softshipper Avatar asked Oct 15 '22 00:10

softshipper


1 Answers

You should use the following: https://github.com/Kotlin/kotlinx.coroutines/tree/master/integration/kotlinx-coroutines-jdk8

Maven/Gradle: https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-jdk8

It is the official jdk8 integration by the kotlin team. Well maintained, and contains examples and documentation on how to use with CompletableFuture

like image 57
Tom Avatar answered Oct 21 '22 04:10

Tom