Daniel Imber
10/21/2020, 8:29 AMwithContext
inside each and every controller function - something like this:
@GetMapping("/foo")
suspend fun getFoo(): Foo {
withContext(SomeCoroutineContextElement()) {
TODO("Do something")
}
}
Is there a better way - i.e. a way to add the context across all controller functions, so I don't need to litter every one of them with withContext
?todd.ginsberg
10/21/2020, 1:38 PMBen
10/21/2020, 4:02 PMfilter { request, next -> withContext() { next(request) } }
Daniel Imber
10/21/2020, 4:03 PMBen
10/21/2020, 4:07 PMDaniel Imber
10/21/2020, 10:40 PM