GlobalSettings onStart fires only after first request

后端 未结 2 839
忘掉有多难
忘掉有多难 2021-01-13 16:29

I need to run some code only once when I starts the play server. When using the GlobalSettings.OnStart() I notice that the code is executed only after the first (http) reque

2条回答
  •  广开言路
    2021-01-13 16:48

    You can emulate that (or I should say, workaround this unfortunate dichotomous design), by using this plugin, which, I find useful also in general:

    addSbtPlugin("com.jamesward" % "play-auto-refresh" % "0.0.11") (plugins.sbt)

    And no, it is not really currently documented in any right place, that this is how OnStart works.

提交回复
热议问题