Reputation:
I'm having a problem with a migration to Play 2.5 with Scala. I had to start using DependencyInjection and after reading all the Play Framework 2.5 migration documentation and making all the corresponding implementations I arrived to an strange problem. Play indicates that class Routes should be automatically generated with the new DependencyInjection schema but when I tried to import the class in my custom ApplicationLoader, the compiler tells me that cannot resolve symbol "router". Below is part of my code, hope you can help me with this, thanks!
import controllers.Assets
import controllers.api.clients.ClientsController
import play.api.ApplicationLoader.Context
import play.api._
import play.api.libs.ws.ahc.AhcWSComponents
import router.Routes
class AppLoader extends ApplicationLoader {
def load(context: Context) = {
LoggerConfigurator(context.environment.classLoader).foreach {
_.configure(context.environment)
}
new AppComponents(context).application
}
}
class AppComponents(context: Context) extends BuiltInComponentsFromContext(context) with AhcWSComponents {
lazy val clientsController: ClientsController = new ClientsController(wsClient)
lazy val assets: Assets = new Assets(httpErrorHandler)
lazy val router = new Routes(
httpErrorHandler,
clientsController,
assets
)
}
Upvotes: 2
Views: 1211
Reputation: 11244
Check the following:
Make sure your build.sbt
contains routesGenerator := InjectedRoutesGenerator
Execute playCompileEverything
in sbt
and refresh your project in your IDE
Upvotes: 6