api / org.gradle.play / PlayApplicationSpec / setInjectedRoutesGenerator

setInjectedRoutesGenerator

abstract fun setInjectedRoutesGenerator(injectedRoutesGenerator: Boolean): Unit

Configures the style of router to use with this application.

By default, a static routes generator is used to generate a singleton router. This requires that all the actions that the router invokes on the application's controllers are either Scala singleton objects, or Java static methods.

In Play 2.4+, a injected routes generator is recommended. This requires that the router declares its dependencies to the application's controllers in its constructor. The controllers methods need to be instance methods.

Parameters

injectedRoutesGenerator - false if a static router should be generated (default). true if an injected router should be generated.