One possible solution would be to create a new Guice Module to bind a new router:
class RouterModule extends AbstractModule { override def configure(): Unit = { bind(classOf[Router]).to(classOf[CustomRouter]) } }
Next, define a new Application Loader that will override the default router using the newly created module:
class MyApplicationLoader extends GuiceApplicationLoader with GuiceableModuleConversions { override protected def overrides(context: Context): Seq[GuiceableModule] = { Seq(fromGuiceModule(new RouterModule)) ++ super.overrides(context) } }
And use the newly created application loader, not the default, in application.conf:
play.application.loader = "de.zalando.store.pdp.modules.MyApplicationLoader"
Danix
source share