How to inject Application in Play Framework 2.5 template
<p>With the new Version 2.4/2.5 of the Play Framework they moved further towards injecting everything and removing the servers state. <strong><code>play.Play.application()</code> is now deprecated.</strong> However, I need the application in my template (e.g. to get all supported languages displayed on all pages with <code>play.i18n.Lang.availables(play.Play.application())</code>).</p>

<p>I'm aware I could:</p>

<ul>
<li>Pass <code>play.Application</code> explicitly to all of my templates.</li>
<li>Add an implicit parameter to my template like <code>@()(implicit app: play.Application)</code>. However, in my Java-Project it's not really implicit, I have to pass it every time I render the template.</li>
<li><a href="https://stackoverflow.com/questions/32934709/play-framework-2-4-use-injected-variable-in-scala-template">Create a Scala object providing the application implicitly</a>. However, this also needs the deprecated <code>play.api.Play.current</code>.</li>
</ul>

<p><strong>How can I inject <code>play.Application</code> in my templates?</strong></p>

<p><strong>---- Update: ----</strong></p>

<p>What I've tried so far, I created the following setup:</p>

<p><strong>index.scala.html:</strong></p>

<pre><code>@(title: String)
@template(title) { //here is the play.Application obviously missing, however I don't want to pass it in every template - even worse in every Controller &lt;-- this is the core of my question
    Welcome to my page!
}
</code></pre>

<p><strong>template.scala.html:</strong></p>

<pre><code>@(title: String)(content: Html)(implicit app: play.Application)
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;@title&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;p&gt;Is live? @app.isProd&lt;/p&gt;
        @content
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p><strong>Controller function:</strong></p>

<pre><code>public Result index() {
    return ok(views.html.index.render("home"));
}
</code></pre>