Spring and Coroutines - Quick Tips

This will be a fast-paced sequence of tips for using Kotlin Coroutines with Spring. Tip 1 If you need transactions, don’t forgot to use the @EnableTransactionManagement annotation. Tip 2 Probably you do not want to .subscribe to your Mono/Flux instances like in the example below: 1 2 3 4 5 6 7 8 9 10 suspend fun handleSomeRequest(request: ServerRequest): ServerResponse { val someNewEntity = SomeEntity() someEntityRepository.save(someNewEntity).subscribe() // some other stuff....

February 15, 2021 · 1 min · Fernando