Dependency Injection with Play Framework

47 views
Skip to first unread message

Bouine Mohamed Ali

unread,
Mar 2, 2018, 10:54:13 AM3/2/18
to Play framework dev
I have started recently working with play but 2 days ago i have seen a problem with DI I do my research and i  asked about it in play's gitter group but nothing helps
so is it possible that play does'nt support this kind of DI? here is my code:
this is the trait:

import javax.inject.{Inject, Singleton}
trait UserDAO{
def save(user: Users): Unit
}
this is the Users cas class:
case class Users(id:String ,mail: String, password: String,role:Role)
this the module class for binding which is enabled in application.conf

class Module extends AbstractModule {
def configure() {
bind(classOf[UserDAO]).to(classOf [MongoUserDAO])
}
and class controller where i inject
class UsersController @Inject()( val userDAO: UserDAO ,
val components: MessagesControllerComponents)
extends MessagesAbstractController(components){

thanks for any help

Dominik Dorn

unread,
Mar 2, 2018, 11:08:29 AM3/2/18
to Bouine Mohamed Ali, Play framework dev
Hi Bouine Mohamed Ali,

this mailinglist is for developers of the playframework itself, not for user-questions.
Please refer to https://groups.google.com/forum/#!forum/play-framework for the user-mailinglist.

As for your problem: this should work, please create a thread in the normal mailinglist and post the error you're getting.

cheers,
Dominik


--
You received this message because you are subscribed to the Google Groups "Play framework dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-dev+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages