title: Upgrading from Play 2.6 to 2.7: How to refactor this Play.current statement to use DI
body: <p>In my Java 8 Play 2.6 application I have this particular line in a MessageConsumer class that reads a "Rule" record in the DB and sends the JSON message (<code>node</code>) to a specific processor based on the type configured on the rule column. <code>ProcessType</code> is an enum of Sub Classes that all extend from a base (Super class) process.  </p>
  
  <pre><code>Play.current().injector().instanceOf(ProcessType.getClass(matchingRule.getProcessType())).processMessage(node, matchingRule);
  </code></pre>
  
  <p>I'm having trouble figuring out how to refactor this and don't want to add the <code>allowGlobalApplication = true</code> config parameter if I can avoid it. </p>