title: Alternative to using Akka.system inside an object
body: <p>I am learning the Play Framework together with Scala, and I looked at the <code>reactive-stocks</code> tutorial that comes with <code>activator</code> for learning more about the framework.</p>
  
  <p>In the learning project that I am creating (a simple chat) I want to have something similar to this snippet taken out from the tutorial:</p>
  
  <pre><code>object StocksActor {
    lazy val stocksActor: ActorRef = Akka.system.actorOf(Props(classOf[StocksActor]))
  }
  </code></pre>
  
  <p>That is, an actor that will only be instanciated one time on the application. But I found out that <code>Akka.system</code> is deprecated, so I should use dependency injection to get the <code>ActorSystem</code>. How would I do dependency injection in an Object? </p>
  
  <pre><code>object ChatRoomsActor @Inject() (actorSystem: ActorSystem) {
    lazy val ref: ActorRef = actorSystem.actorOf(Props(classOf[ChatRoomsActor]))
  }
  </code></pre>
  
  <p>I tried this code, but it doesn't work.</p>