简体   繁体   中英

about Playframework Global

i added some code inside Global.scala, and application.conf application.global=Global

object Global extends WithFilters(new GzipFilter()) with GlobalSettings {
  override def onStart(app: Application) {
    Logger.info("Application started.")
  }

  override def onStop(app: Application) {
    Logger.info("Application shutdown...")
  }
}

Why run 3 times in conole ?

[info] application - Application started.
[info] application - Application started.
[info] application - Application started.
[info] wobo - Application started (Dev)
[WARN] [10/21/2013 15:54:50.591] [New I/O worker #1] [EventStream(akka://play)]akka.event-handlers] config is deprecated, use [akka.loggers]
[info] application - Application shutdown...
[info] application - Application shutdown...
[info] application - Application shutdown...

OnStart is might called multiple times because you have dependencies to Play plugins that are older than your application Play version.

You can exclude the older Play dependencies in SBT, for example how to do it for the typesafe mail plugin in build.sbt or Build.scala:

 "com.typesafe" %% "play-plugins-mailer" % "2.2.0" exclude ("org.scala-stm", "scala-stm_2.10.0") exclude("play", "*")

I think it happens because Play has a new Group ID so SBT does not recognize it as the same library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM