How to use `controllers.Default.redirect` in Play 2.4 and `InjectedRoutesGenerator`

657 views Asked by At

If I try to use controllers.Default.redirect(to = "/foo/bar") in my routes file with routesGenerator := InjectedRoutesGenerator enabled in my build.sbt file, I get the compilation error

type Default is not a member of package controllers

With this new injected routes feature in Play 2.4 is there still a way to use handlers defined in static objects?

1

There are 1 answers

0
James Roper On BEST ANSWER

No there's not. Default should be made a class so it can be used from an injected router, with a companion object that extends it so it can still be used from the static router. Please raise an issue in the Play issue tracker, or better, submit a pull request to fix this.