Play framework + Slick, use trait for any tables and use Inject() dbConfig for this trait, how fix?

50 views
Skip to first unread message

Anatoliy Evladov

unread,
Nov 23, 2016, 1:34:25 AM11/23/16
to Slick / ScalaQuery
Hi! 
I very bad speaking for english, sorry..

I have 1 trait, 1 class and 1 object:

If i use 
trait ModelDef[T, MTD <: ModelTableImpl[T]] extends DBConfig 
and 
val db = dbConfigProvider.get[JdbcProfile].db
 i see not enough arguments for constructor DBConfig: (dbConfigProvider: play.api.db.slick.DatabaseConfigProvider)dao.DBConfig.
Unspecified value parameter dbConfigProvider.

and i just do not know - how to fix it?
i will answer any questions..

Margus Sipria

unread,
Nov 25, 2016, 4:38:57 AM11/25/16
to Slick / ScalaQuery
I don't know how you could inject something to scala object's, i use objects to to return `DBIOActions` and where call is needed for database I have injected db.

You can also make ApiKeysDAO class, that has injected DatabaseConfigProvider  and then at that class you just call: db.run(ApiKeys.isActive(key)))
Reply all
Reply to author
Forward
0 new messages