Need help fixing "No implementation for play.api.db.slick.DatabaseConfigProvider was bound"

1,985 views
Skip to first unread message

Napoleon Quashie

unread,
Jun 16, 2016, 12:31:32 AM6/16/16
to play-framework
Hi all this is my first post. I am learning Scala and Play Framework and I'm attempting to write my first database backed web app. At the moment my application gives me the following error which I need help with.

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 parameter 0 at controllers.HomeController.<init>(HomeController.scala:19)

Below are the current code that I have in all the relevant files:

build.sbt
name := """RocfPlay"""

version
:= "1.0-SNAPSHOT"

lazy val root
= (project in file(".")).enablePlugins(PlayScala)

scalaVersion
:= "2.11.7"

libraryDependencies
++= Seq(
  cache
,
  ws
,
 
"org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % Test,
 
"com.typesafe.play" %% "play-slick" % "2.0.0",
 
"com.typesafe.play" %% "play-slick-evolutions" % "2.0.0",
 
"org.postgresql" % "postgresql" % "9.4-1206-jdbc42"
)

resolvers
+= "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"


application.conf
 slick.dbs.default.driver="slick.driver.PostgresDriver$"
  slick
.dbs.default.db.driver="slick.jdbc.DatabaseUrlDataSource"
  slick
.dbs.default.db.properties.driver="org.postgresql.Driver"
  slick
.dbs.default.db.username=root
  slick
.dbs.default.db.password=""

HomeController.scala
package controllers

import javax.inject._
import play.api._
import play.api.mvc._

import scala.concurrent.Future
import play.api.db.slick.DatabaseConfigProvider
import play.api.db.slick.HasDatabaseConfigProvider
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import slick.driver.JdbcProfile


@Singleton
class HomeController @Inject()(dbConfigProvider: DatabaseConfigProvider) extends Controller {

  val dbConfig
= dbConfigProvider.get[JdbcProfile]


 
def index = Action {
   
Ok(views.html.index("Your new application is ready."))
 
}

}



The application was generated by option 6 from the command
activator new

I haven't modified anything else apart from the above. What I want to do is hook the application up to a postgres database calles rocf_db and create a basic crud application.

Cheers










Message has been deleted

gitted

unread,
Jul 12, 2016, 5:43:21 PM7/12/16
to play-framework
I am experiencing the same thing, any tips?

Abdelhamide EL ARIB

unread,
Jul 14, 2016, 6:01:18 AM7/14/16
to play-framework
Yeaah i have the same issue ... Did you find anything ?
Thanks

law karingithi

unread,
Jul 28, 2016, 12:46:58 PM7/28/16
to play-framework
Try upgrading to the latest release of Play framework. I'm using 2.5.4 and the injection works fine.

Victor Declerk

unread,
Sep 24, 2016, 12:15:01 AM9/24/16
to Play Framework
I solved this issue moving my database configuration outside the db { } block in application.conf file.

Roberto Burgos

unread,
Nov 3, 2016, 7:50:34 PM11/3/16
to Play Framework
Thank you so much! That did it for me too.
Reply all
Reply to author
Forward
0 new messages