Nocebo
Nocebo

Reputation: 2017

Scala object Action in package mvc is deprecated

I'm currently working on a new project and face a warning I haven't seen in older projects yet.

enter image description here

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:

enter image description here

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

Answers (1)

Jeffrey Chung
Jeffrey Chung

Reputation: 19527

The warning message tells you what to do (more information is in the linked sections of the Play 2.6 migration guide):

  1. Inject an ActionBuilder (e.g. DefaultActionBuilder) or
  2. extend BaseController/AbstractController/InjectedController

Upvotes: 3

Related Questions