Created
May 2, 2016 23:04
-
-
Save eishay/2bb7b323ef29fa652036ade61484eb79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Singleton | |
class ActorInstance[T <: Actor] @Inject() ( | |
systemProvider: Provider[ActorSystem], builder: ActorBuilder, provider: Provider[T]) { | |
lazy val ref: ActorRef = builder(systemProvider.get, provider) | |
} | |
@ImplementedBy(classOf[ActorBuilderImpl]) | |
trait ActorBuilder { | |
def apply(system: ActorSystem, provider: Provider[_ <: Actor]): ActorRef | |
} | |
class ActorBuilderImpl extends ActorBuilder { | |
def apply(system: ActorSystem, provider: Provider[_ <: Actor]): ActorRef = | |
system.actorOf(Props { provider.get }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment