title: Migration to Play 2.5.3 - Crypto library deprecated but also perhaps broken?
body: <p>Currently receiving this error while trying to move an application to 2.5.3 </p>
  
  <pre><code>Error injecting constructor, java.lang.RuntimeException: The global crypto instance requires a running application!
  </code></pre>
  
  <p>Am wading through close to 1000 errors (reported so far - once I clear a batch then low and behold yet another batch show up so there could be lots more)</p>
  
  <p>I can't seem to get a handle on how to fix this particular one however. The migration guide indicates that the library is deprecated and will be removed and offers replacement paths -- none of which appear trivial -- but it doesn't indicate how to get the library instantiated with the need for the running Application. </p>
  
  <p>Did find some chatter in github issues but nothing specific to the actual problem. </p>
  
  <p>All I need (right now) is <code>Crypto.encryptAES</code> and <code>Crypto.decryptAES</code> replacements if the library can't be properly started if a quick sub is possible.  </p>
  
  <p>This problem currently stops Play dead in it's tracks btw so I have no idea what comes next once I get past this issue. </p>
  
  <p>DI would supposedly handle this and yet it obviously doesn't. </p>
  
  <p>Here is relevant portion of stack trace I'm seeing: </p>
  
  <p><code>1 error
      at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025)
      at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
      at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:405)
      at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:400)
      at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
      at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
      at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:158)
      at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:155)
      at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
      at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:155)
      ... 15 common frames omitted
  Caused by: java.lang.RuntimeException: The global crypto instance requires a running application!
      at scala.sys.package$.error(package.scala:27)
      at play.api.libs.Crypto$$anonfun$crypto$1.apply(Crypto.scala:56)
      at play.api.libs.Crypto$$anonfun$crypto$1.apply(Crypto.scala:56)
      at scala.Option.fold(Option.scala:158)
      at play.api.libs.Crypto$.crypto(Crypto.scala:57)
      at play.api.libs.Crypto$.encryptAES(Crypto.scala:78)
  </code></p>
  
  <p>I used that to find this: <a href="https://github.com/playframework/playframework/blob/2.5.3/framework/src/play/src/main/scala/play/api/libs/Crypto.scala" rel="nofollow">https://github.com/playframework/playframework/blob/2.5.3/framework/src/play/src/main/scala/play/api/libs/Crypto.scala</a> in the hopes that it might shed some light but I'm still at a loss as to how to address. </p>