Reputation: 2017
I'm currently working on a new project and face a warning I haven't seen in older projects yet.
The warning says that Action
from the mvc
package is deprecated since 2.6.0. I guess it has something to do with Play or Scala itself. So this is my code responsible for the warning:
def getLists: Action[AnyContent] = Action.async {
listRepo.getLists.map(lists => Ok(Json.obj("lists" -> lists)))
}
My buildt.sbt
looks like this:
And this is how I import the Action
object:
import play.api.mvc.{Action, AnyContent, Controller}
Is there an equivalent alternative or am I doing something wrong?
Upvotes: 1
Views: 1017
Reputation: 19527
The warning message tells you what to do (more information is in the linked sections of the Play 2.6 migration guide):
Inject an ActionBuilder (e.g. DefaultActionBuilder)
orextend BaseController/AbstractController/InjectedController
Upvotes: 3