I have problem with GlobalSettings in Play framework. The method onStart is not executed. This is my code:
package app
import akka.actor.ActorSystem
import play.{GlobalSettings, Logger}
object Global extends GlobalSettings {
val system = ActorSystem("app")
Logger.info("test1")
override def onStart(app: play.Application): Unit = {
super.onStart(app)
Logger.info("test2")
}
}
In console I can see only test1. Could someone tell me what I doing wrong.
One issue is what Vidya wrote. Another one is that your Global object is in the "app" package. It should be not according to the documentation: http://www.playframework.com/documentation/2.2.x/ScalaGlobal
"This object must be defined in the default (empty) package"
And one more issue. My favourite one in Play. You are not importing correct packages. Do this:
import akka.actor.ActorSystem
import play.api._