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

50 vues
Accéder directement au premier message non lu

Anatoliy Evladov

non lue,
23 nov. 2016, 01:34:2523/11/2016
à 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

non lue,
25 nov. 2016, 04:38:5725/11/2016
à 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)))
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message