Maciej Tułaza
Maciej Tułaza

Reputation: 510

No implementation Slick DatabaseConfigProvider was bound

I have just created a dummy project and try to integrate Play with Slick. I followed the official tutorial but unfortunatelly did not manage do run it properly. Everytime I try to run the app I get following error:

play.api.UnexpectedException: Unexpected exception[ProvisionException: Unable to provision, see the following errors:

1) No implementation for play.api.db.slick.DatabaseConfigProvider was bound.
  while locating play.api.db.slick.DatabaseConfigProvider
    for the 1st parameter of com.reciper.repository.UserRepository.<init>(UserRepository.scala:13)

Here are my configs:

build.sbt

scalaVersion := "2.12.2"

libraryDependencies += guice
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test
libraryDependencies += "com.typesafe.play" %% "play-slick" % "3.0.3"
libraryDependencies += "com.typesafe.play" %% "play-slick-evolutions" % "3.0.3"
libraryDependencies += "org.postgresql" % "postgresql" % "42.2.4"

application.conf

play.evolutions {
  autoApply = true
}

#Slick for Play
slick.profile = "slick.jdbc.PostgresProfile$"
slick.db.driver = "org.postgresql.Driver"
slick.db.url = "jdbc:postgresql://localhost:5432/reciper"
slick.db.user = "postgres"
slick.db.password = "postgres"

UserRepository.scala

@Singleton
class UserRepository @Inject()(protected val dbConfigProvider: DatabaseConfigProvider)
                              (implicit executionContext: ExecutionContext) extends HasDatabaseConfigProvider[PostgresProfile] { ..codehere.. }

HomeController.scala

@Singleton
class HomeController @Inject()(repo: UserRepository) {...}

plugins.sbt

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.13")

I have been struggling with it for more than 3 days now and lost my hope that it will actually work.. tried many options, none worked

Do you know what is missing or wrong? Let me know if you need any other file Thanks!

Upvotes: 1

Views: 906

Answers (1)

Nagarjuna Pamu
Nagarjuna Pamu

Reputation: 14825

Following configuration in application.conf works

build.sbt

"com.typesafe.play" %% "play-slick" % "3.0.3"

application.conf

slick.dbs.default.driver="slick.driver.PostgresDriver$"
slick.dbs.default.db.driver="org.postgresql.Driver"
slick.dbs.default.db.url="jdbc:postgresql://ec2-54-217-243-228.eu-west-1.compute.amazonaws.com:5432/d344onl0761ji5"
slick.dbs.default.db.user=user
slick.dbs.default.db.password="pass"

Upvotes: 1

Related Questions