How to set up play framework ApplicationLoader and Macwire to work with custom routes?

Viewed 1228

I set up the application loader this way:

class MyProjectApplicationLoader extends ApplicationLoader {
  def load(context: Context): Application = new ApplicationComponents(context).application
}

class ApplicationComponents(context: Context) extends BuiltInComponentsFromContext(context)
  with QAControllerModule
  with play.filters.HttpFiltersComponents {

  // set up logger
  LoggerConfigurator(context.environment.classLoader).foreach {
    _.configure(context.environment, context.initialConfiguration, Map.empty)
  }

  lazy val router: Router = {
    // add the prefix string in local scope for the Routes constructor
    val prefix: String = "/"
    wire[Routes]
  }
}

but my routes is custom, so it looks like:

the routes file:

-> /myApi/v1 v1.Routes
-> /MyHealthcheck HealthCheck.Routes

and my v1.Routes file:

GET    /getData    controllers.MyController.getData

so now when I compile the project I get this error:

Error: Cannot find a value of type: [v1.Routes] wire[Routes]

so im not sure how to fix this, does someone know how can I make the loader to work with this structure of routes?

2 Answers
Related