简体   繁体   中英

Play framework update version from 2.3 to 2.4 dependency injection support

I'm starting migration play from 2.3, 2.4. So after update of plugin.sbt with new version: addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.6") during sbt clean compile happened an error (in Global.scala) linked to a method getControllerInstance in the instruction: instance.getOrElse(super.getControllerInstance(controllerClass))

instance.getOrElse(super.getControllerInstance(controllerClass)) . /Global.scala:244: value getControllerInstance is not a member of play.api.mvc.WithFilters with play.api.GlobalSettings [error]
instance.getOrElse(super.getControllerInstance(controllerClass)) [error] ^

The problem seems to be related to the fact that play 2.4 does not support dependency injection which is out of the box. Not wanting to use Guice, how can I fix this?

Read the migration guide and especially the section Dependency injection

You have to use DI (or compile time DI). Guice is the default framework proposed by Play but you can use another one if you don't want Guice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM