Injecting the current App in Play 2.5.2
<p>I am using the DI to access my App in Play 2.5:</p>

<pre><code>import com.google.inject.{Inject, Provider}
import play.api.mvc._
import play.api.Application

class ApplicationController @Inject()(p: Provider[Application]) extends Controller {
  implicit lazy val app = p.get()
  println(app.hashCode()+"") // Random line to use the injected app
}
</code></pre>

<p>I am getting the following error : </p>

<pre><code>ProvisionException: Unable to provision, see the following errors:

1) Tried proxying play.api.Application to support a circular dependency, but circular proxies are disabled. ...
</code></pre>

<p>I went on the Play Migration guide : <a href="https://www.playframework.com/documentation/2.5.x/Migration25#Handling-legacy-components" rel="nofollow">https://www.playframework.com/documentation/2.5.x/Migration25#Handling-legacy-components</a></p>

<p>and did as they say to avoid circular dependency, however I still have that error.</p>

<p>I've also found a variable called disableCircularProxies which I am not currently using (<a href="http://google.github.io/guice/api-docs/latest/api-diffs/changes/docdiffs_com.google.inject.html" rel="nofollow">http://google.github.io/guice/api-docs/latest/api-diffs/changes/docdiffs_com.google.inject.html</a>) as I am not sure how to do so and found very little info about it.</p>

<p>Any idea how to solve this circular dependency error ?  </p>

<p>Here is the full stack trace : </p>

<pre><code>   Tried proxying play.api.Application to support a circular dependency, but circular proxies are disabled.
  at play.api.DefaultApplication.class(Application.scala:221)
  while locating play.api.DefaultApplication
  while locating play.api.Application
  at myCustomProject.controllers.ApplicationController.&lt;init&gt;(ApplicationController.scala:9)
  while locating myCustomProject.controllers.ApplicationController
    for parameter 1 at router.Routes.&lt;init&gt;(Routes.scala:31)
  while locating router.Routes
  while locating play.api.inject.RoutesProvider
  while locating play.api.routing.Router
    for parameter 0 at play.api.http.JavaCompatibleHttpRequestHandler.&lt;init&gt;(HttpRequestHandler.scala:200)
  while locating play.api.http.JavaCompatibleHttpRequestHandler
  while locating play.api.http.HttpRequestHandler
    for parameter 4 at play.api.DefaultApplication.&lt;init&gt;(Application.scala:221)
  at play.api.DefaultApplication.class(Application.scala:221)
  while locating play.api.DefaultApplication
  while locating play.api.Application
</code></pre>

<p>Ultimately, I shouldn't be using this Provider[Application] but rather the configuration, environment, ... from the App.
It's just that according to the doc, I should be able to have that working.</p>