我已经阅读了 2.6.x迁移指南和WS 迁移指南,并且已经解决了大多数初始错误,但我似乎无法通过应用程序启动时发生的这个错误:
CreationException: Unable to create injector, see the following errors:
1) Could not find a suitable constructor in play.api.libs.ws.ahc.AhcWSClientConfig.
Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
at play.api.libs.ws.ahc.AhcWSClientConfig.class(AhcConfig.scala:37) while locating play.api.libs.ws.ahc.AhcWSClientConfig for the 1st parameter of play.libs.ws.ahc.AhcWSAPI.<init>(AhcWSAPI.java:28)
at play.libs.ws.ahc.AhcWSModule.bindings(AhcWSModule.java:23): Binding(interface play.libs.ws.WSAPI to ConstructionTarget(class play.libs.ws.ahc.AhcWSAPI)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
WS 迁移指南提到 WSAPI 已被弃用,但似乎 GUICE 仍在尝试绑定到已实现的类?我真的不确定。
如果有帮助,请查看我的 libraryDependencies。
libraryDependencies ++= Seq(
javaJpa,
"org.hibernate" % "hibernate-entitymanager" % "5.1.0.Final",
"org.postgresql" % "postgresql" % "9.4.1208.jre7",
"com.elemica" %% "apollo-commons" % "0.1.47-SNAPSHOT",
"com.jayway.jsonpath" % "json-path" % "2.1.0",
"com.typesafe.play" %% "play-mailer" % "5.0.0-M1",
"com.rabbitmq" % "amqp-client" % "3.6.2",
"org.freemarker" % "freemarker" % "2.3.25-incubating",
"com.amazonaws" % "aws-java-sdk" % "1.11.133",
"org.redisson" % "redisson" % "2.1.4",
"com.h2database" % "h2" % "1.4.196",
ws,
guice,
openId
)
插件.sbt:
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.6")
// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.4.11")
addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.2.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")