Play 2.5 priming the web service
<p>I have a restful web service developed using play 2.5 framework. 
I want to prime my web service on start by calling itself. This is to make sure that my service is perfectly up and running. </p>

<p>The approach i am taking is using <a href="https://www.playframework.com/documentation/2.5.x/ScalaDependencyInjection#Eager-bindings" rel="nofollow noreferrer">eagerBinding</a>. But the code inside the class injected using eager binding gets executed just before the app starts</p>

<p>Here is what my eagerbinding code looks like</p>

<pre><code>@Singleton
class PrimingMe @Inject()(ws: WSClient) {

  isServicePrimed

  def isServicePrimed: Boolean = {

    println("PRIME ME!!!")
    val response = ws.url("http://localhost:9000/index").get
      .map {
        response =&gt;
          response.status match {
            case 200 =&gt; true
            case _ =&gt; false
          }
      }

    try {
      Await.result(response, 5.second)
    } catch {
      case _ =&gt; false
    }

  }

}


class ServiceInjectionModule extends AbstractModule {

  def configure(): Unit = {

    bind(classOf[PrimingMe]).asEagerSingleton
  }
}
</code></pre>

<p>Inside application.conf</p>

<pre><code>play.modules.enabled += "util.ServiceInjectionModule"
</code></pre>

<p>I want to prime my application with a dummy service call so that when the real traffic starts coming all db connections are made. Currently my first api call to the service takes much longer than the usual. What other options do i have to achieve this.</p>