播放2.6,播放2-Maven插件,自定义加载程序,MessagesApi注入器问题

时间:2018-07-24 16:21:55

标签: playframework

我正在努力启动一个Play应用程序,该应用程序正在迁移至Play 2.6版本。

我寻找解决方案的搜索失败。

我已经扩展了GuiceApplicationLoader,并且正在使用play2-maven-plugin

7) No implementation for play.api.i18n.MessagesApi was bound.
  while locating play.api.i18n.MessagesApi
    for the 1st parameter of play.i18n.MessagesApi.<init>(MessagesApi.java:27)
  while locating play.i18n.MessagesApi
    for the 1st parameter of play.core.j.DefaultJavaContextComponents.<init>(JavaAction.scala:172)
  at play.api.inject.BuiltinModule$$anonfun$$lessinit$greater$1.apply(BuiltinModule.scala:81):
Binding(interface play.core.j.JavaContextComponents to ConstructionTarget(class play.core.j.DefaultJavaContextComponents)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)

8) No implementation for play.api.mvc.FlashCookieBaker was bound.

9) No implementation for play.api.mvc.SessionCookieBaker was bound.

我包括以下依赖项

<dependency>
    <groupId>com.typesafe.play</groupId>
    <artifactId>play_2.12</artifactId>
</dependency>

1 个答案:

答案 0 :(得分:0)

MessagesApi现在位于单独的播放模块中:https://github.com/playframework/playframework/blob/2.6.17/framework/src/play/src/main/scala/play/api/i18n/I18nModule.scala

这包含在默认的Play reference.conf中:https://github.com/playframework/playframework/blob/2.6.17/framework/src/play/src/main/resources/reference.conf#L817

默认情况下,只要依赖项位于类路径上,就应该加载此reference.conf,因此它应该可以正常工作。我正在覆盖application.conf中的play.modules.enabled

play.modules { enabled = []