Scala play Unit test controller 2.6.x - 并发包中的对象执行已弃用:请参阅 2.6 迁移指南

Scala play Unit test controller 2.6.x - object Execution in package concurrent is deprecated: Please see 2.6 migration guide

尝试遵循 Scala Play 框架 2.6 版的迁移指南: https://playframework.com/documentation/2.6.x/Highlights26

升级后我的测试失败了:

val controller = new ProductController(stubControllerComponents().asInstanceOf[ProductControllerComponents])

我得到:

> object Execution in package concurrent is deprecated: Please see
> https://www.playframework.com/documentation/2.6.x/Migration26#Execution

这是我的控制器声明:

class ProductController @Inject()(cc: ProductControllerComponents)(implicit ec: ExecutionContext)
    extends ProductBaseController(cc)

我注入的执行上下文是"executionContext: scala.concurrent.ExecutionContext"

我正在按照官方 play framework 2.6 示例进行操作,但仍然测试未编译并抛出上面的错误消息。

playframework/framework/src/play/src/main/scala/play/api/mvc/Controller.scala

  /**
   * The default execution context provided by Play. You should use this for non-blocking code only. You can do so by
   * passing it explicitly, or by defining an implicit in your controller like so:
   *
   * {{{
   *   implicit lazy val executionContext = defaultExecutionContext
   * }}}
   */
  def defaultExecutionContext: ExecutionContext = controllerComponents.executionContext