Accepted answer

If your globals also need to be available to the methods in Global, put them in Global.scala like so:

package object globals {
  lazy val abc = Play.maybeApplication.flatMap(_.configuration.getString("abc")).getOrElse("default_value_of_abc")
  lazy val someActor = Akka.system.actorOf(Props[SomeActor], name = "someActor")

And then use it in your controllers like this:

globals.someActor ! SomeMessage


The documentation has since been updated how add Global.scala in an idiomatic Play! way, with docs for both Scala and Java.

Related Query

More Query from same tag