我've been trying to connect to a local postgres from Scala Play but for some reason can'似乎能够导入 Database
和 NamedDatabase
.
尝试使用 import play.api.db._
或 import play.api.db.{ Database, NamedDatabase }
导入时,收到 Can't resolve symbol db
错误 . 这实际上是有道理的 . 我've tried re-importing the project and rebuilding in IntelliJ but it still won'工作 . db
导入的内容是否因未记录的内容而发生变化?这些import语句直接来自Scala Play教程页面:
https://www.playframework.com/documentation/2.5.x/ScalaDatabase
我还在 build.sbt
中包含了postgres依赖项,但我认为这是无关紧要的:
"postgresql" % "postgresql" % "9.1-901.jdbc4",
这是一张显示正在发生的事情的图片:
1 回答
啊,我只是忘了添加一个依赖:
这解决了一切 .