【发布时间】:2015-12-08 03:45:55
【问题描述】:
我有一个连接到两个数据库的应用程序,默认数据库模型在根项目中,第二个数据库模型在子项目中。 我的项目,一个简短的文件夹结构看起来像这样
[root]/build.sbt
[root]/conf/application.conf
[root]/app/models/Author.java (and other models)
[root]/module/build.sbt
[root]/module/app/mods/User.java
并且 application.conf 已经像这样配置了 ebean
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://localhost:5432/main"
db.default.username=postgres
db.default.password="password"
db.second.driver=org.postgresql.Driver
db.second.url="jdbc:postgresql://localhost:5432/second"
db.second.username=postgres
db.second.password="password"
ebean.default = ["models."]
ebean.second = ["mods."]
和这样的 build.sbt:
lazy val module = project.in(file("module")).enablePlugins(PlayJava, PlayEbean, PlayEnhancer)
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
.aggregate(module)
.dependsOn(module)
但是当我运行应用程序时,我得到了这个异常
Error injecting constructor, java.lang.IllegalStateException: Bean class mods.User is not enhanced?
显然子项目中的模型没有得到增强。我如何让它工作?
【问题讨论】: