在 play.db.ebean.EbeanPlugin 中找不到合适的构造函数,如何解决这个问题?
Could not find a suitable constructor in play.db.ebean.EbeanPlugin, how to resolve this issue?
出现以下错误:
ConfigurationException: Guice configuration errors:
1) Could not find a suitable constructor in play.db.ebean.EbeanPlugin. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
at play.db.ebean.EbeanPlugin.class(EbeanPlugin.java:23)
while locating play.db.ebean.EbeanPlugin
1 error
任何人都可以帮我解决这个问题吗?我是游戏框架的新手,无法真正解决此类问题。
package models;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import play.db.ebean.Model;
@MappedSuperclass
public class Bar extends Model {
@Id
public String id;
public String name;
}
plugin.sbt
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")
// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
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("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
// Play enhancer - this automatically generates getters/setters for public fields
// and rewrites accessors of these fields to use the getters/setters. Remove this
// plugin if you prefer not to have this feature, or disable on a per project
// basis using disablePlugins(PlayEnhancer) in your build.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
// Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using
// enablePlugins(SbtEbean). Note, uncommenting this line will automatically bring in
// Play enhancer, regardless of whether the line above is commented out or not.
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")
您的 class 没有一个(而且只有一个)用 @Inject 注释的构造函数或非私有的零参数构造函数
尝试添加一个非私有的零参数构造函数,例如
public Bar() {}
出现以下错误:
ConfigurationException: Guice configuration errors:
1) Could not find a suitable constructor in play.db.ebean.EbeanPlugin. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private. at play.db.ebean.EbeanPlugin.class(EbeanPlugin.java:23) while locating play.db.ebean.EbeanPlugin
1 error
任何人都可以帮我解决这个问题吗?我是游戏框架的新手,无法真正解决此类问题。
package models;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import play.db.ebean.Model;
@MappedSuperclass
public class Bar extends Model {
@Id
public String id;
public String name;
}
plugin.sbt
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")
// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
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("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
// Play enhancer - this automatically generates getters/setters for public fields
// and rewrites accessors of these fields to use the getters/setters. Remove this
// plugin if you prefer not to have this feature, or disable on a per project
// basis using disablePlugins(PlayEnhancer) in your build.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
// Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using
// enablePlugins(SbtEbean). Note, uncommenting this line will automatically bring in
// Play enhancer, regardless of whether the line above is commented out or not.
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")
您的 class 没有一个(而且只有一个)用 @Inject 注释的构造函数或非私有的零参数构造函数
尝试添加一个非私有的零参数构造函数,例如
public Bar() {}