Dependency injection and cluster singletons or sharded actors

Hello,

Is there any way to use dependency injection for the instantiation of cluster singleton, sharded actor or in general any type of actor whose Props need to stay serializable?

AkkaGuiceSupport#bindActor works great as long as the spawned actor will remain local, but it won’t work for actors that might move across nodes. Right now I’m using Play.application().injector() from onStart() to locate dependencies, but I’m trying to move away from deprecated methods.

I’m pretty sure you will need an extension to do that, but I don’t have the time right now to figure out all the details. Anyway, this issue (and links there) can be a good starting point:

Best.