I'm migrating to coroutine 1.0.0 for a SpringBoot ...
# server
v
I'm migrating to coroutine 1.0.0 for a SpringBoot app. Previously I can easily create an actor as Spring Bean. How can I create an actor that is injectable for SpringBoot and the new coroutine?
g
I'm not so familiar with Spring, but in general, to create an actor you need parent context, because now all coroutine builders use Structured concurrency approach and require CoroutineScope, so every Coroutine has parent scope So general advice, if you want inject actor, such actor should be injected on some Scope with strict lifecycle to avoid Coroutine leak
But, if you don't want manage lifecycle for some reason, you can have old behavior, just use GlobalScope.actor, this will create an actor that runs on top level of your app and will be destroyed only explicitly or on your app shutdown
👍 1
v
I'll try that. Thanks, Andrey.