无法使用带有Macwire的DI导入子项目的播放路径

时间:2018-05-09 07:07:43

标签: playframework macwire

我正在使用已编译的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]

0 个答案:

没有答案