Can't import Play Routes for subprojects using DI with Macwire

77 Views Asked by At

I'm working on a Play 2.6 project using compiled DI and sub-projects: One difference from a regular Play project is that I create a package under app, so controllers are located at com.company.my.controllers.InfoController. Here is the structure:

my-project
└ apps
  └ backend
    └ app
      └ com.company.my
        └ BackendApplicationLoader
    └ conf
      └ routes (->      /app1                    app1.Routes)
    └ modules
      └ app1
        └ app
          └ com.company.my
            └ App1ApplicationLoader
        └ conf
          └ app1.routes

When I run the project, I have the following error:

Cannot find a value of type: [app1.Routes]

In this file:

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

class BackendComponents(context: Context) extends BuiltInComponentsFromContext(context)
  with HttpFiltersComponents
  with AssetsComponents
{
  implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global
  .....
  lazy val router: Router = {
    val prefix: String = "/"
    wire[Routes]
  }   
}

How can I tell Play to consider those routes? Also, if each subproject, can be a standalone App, should I wire the App1ApplicationLoader class?

And what would be the name wire[app1Routes] or wire[App1Routes]

0

There are 0 best solutions below