2

我正在使用已编译的 DI 和子项目开发 Play 2.6 项目:与常规 Play 项目的一个区别是我在 app 下创建了一个包,因此控制器位于 com.company.my.controllers.InfoController。这是结构:

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

当我运行项目时,出现以下错误:

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

在这个文件中:

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]
  }   
}

我如何告诉 Play 考虑这些路线?另外,如果每个子项目都可以是一个独立的应用程序,我应该连接 App1ApplicationLoader 类吗?

什么是名称wire[app1Routes]或wire[App1Routes]

4

0 回答 0