无法在play.db.ebean.EbeanPlugin中找到合适的构造函数,如何解决此问题?

时间:2015-07-14 18:49:24

标签: java playframework playframework-2.0 guice ebean

出现以下错误:

  

ConfigurationException:Guice配置错误:

     

1)在play.db.ebean.EbeanPlugin中找不到合适的构造函数。类必须有一个(也是唯一一个)使用@Inject注释的构造函数或一个非私有的零参数构造函数。     at play.db.ebean.EbeanPlugin.class(EbeanPlugin.java:23)     找到play.db.ebean.EbeanPlugin

     

1错误

任何人都可以帮助我解决这个问题我是Playframe的新手,并且无法真正解决这个问题。

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")

1 个答案:

答案 0 :(得分:0)

您的类没有一个(且只有一个)使用@Inject注释的构造函数或一个非私有的零参数构造函数

尝试添加非私有的零参数构造函数,例如

public Bar() {}