title: Guice dependency requiring references to Singleton inside AbstractModule
body: <p>I have an external library (<a href="https://github.com/debasishg/scala-redis" rel="nofollow noreferrer">scala-redis</a>) that requires an implicit ActorSystem when initializing the client. I would like to have my RedisClient as a Singleton inside my Play (2.6) Application because it would make sense having it as a Singleton.</p>
  
  <pre><code>class CustomAppModule(environment: Environment,
                       configuration: Configuration) extends AbstractModule {
    def configure() = {
      //val system = getProvider(classOf[ActorSystem]).get()
      //val system = ActorSystem()
      //bind(classOf[ActorSystem]).toInstance(system)
  
      val redis = RedisClient(configuration.get[String]("redis.host"))(system)
      bind(classOf[RedisClient]).toInstance(redis)    
    }
  }
  </code></pre>
  
  <p>First system fails because of "Provider cannot be used until the Injector has been created", and second system fails because Play Framework initializes the ActorSystem itself when the application starts, and second system fails because of "binding to akka.actor.ActorSystem was already configured at play.api.inject.BuiltinModule".</p>
  
  <p>So what would be the idiomatic way with Guice/DI to proceed with this kind of situation? Do I need a wrapper Singleton that has the RedisClient as a value, and where the ActorSystem can be injected?</p>