Problem with PasswordInfoDAO implmentation in Silhouette version 6.1

Hi, I am migrating my app from Silhouette 5.0 to 6.1 and found trouble with PasswordInfoDAO implementation.

My class definition as follows:

class PasswordInfoDAO @Inject() (db: Database)( implicit val classTag: ClassTag[PasswordInfo]) extends DelegableAuthInfoDAO[PasswordInfo]

and in SilhouetteModule:

bind[DelegableAuthInfoDAO[PasswordInfo]].to[PasswordInfoDAO]

I am having the following execution error:

No implementation for scala.reflect.ClassTag<com.mohiva.play.silhouette.api.util.PasswordInfo> was bound.

while locating scala.reflect.ClassTag<com.mohiva.play.silhouette.api.util.PasswordInfo>

for the 2nd parameter of models.daos.PasswordInfoDAO.(PasswordInfoDAO.scala:18)

at modules.SilhouetteModule.configure(SilhouetteModule.scala:83) (via modules: com.google.inject.util.Modules$OverrideModule -> modules.SilhouetteModule)

This class was executing well in version 5.0. I should be missing something.

Please help

Thank you

Hi,

We had this topic a while back in the gitter channel:

https://gitter.im/mohiva/play-silhouette?at=5d47f9ab3d8f1f29e0157831

Thank you Akkie for your quick response

I have included a Provider in the class definition as follows:

class PasswordInfoDAO @Inject() (db: Database, classTagProvider: Provider[ClassTag[PasswordInfo]])
extends DelegableAuthInfoDAO[PasswordInfo] {

val classTag = classTagProvider.get()

and still getting the same execution error:

No implementation for scala.reflect.ClassTag<com.mohiva.play.silhouette.api.util.PasswordInfo> was bound.

while locating com.google.inject.Provider<scala.reflect.ClassTag<com.mohiva.play.silhouette.api.util.PasswordInfo>>

for the 2nd parameter of models.daos.PasswordInfoDAO.(PasswordInfoDAO.scala:19)

at modules.SilhouetteModule.configure(SilhouetteModule.scala:83) (via modules: com.google.inject.util.Modules$OverrideModule -> modules.SilhouetteModule)

Would you please provide an example of Silhouette 6.1 PasswordInfo DAO persistance implementation ? Any other path you might suggest ?

Thank you

You should use a Guice @Provides annotated method with a param classTag: ClassTag[PasswordInfo]. It will be filled automatically by the compiler.

I’ll add this to the migration guide if I’m home from vacation

Akkie, please tell me where the Guice @Provides annotated method should be defined. An implementation example of this will be very much appreciated.

Thanks.

1 Like

@gObando Please see https://www.silhouette.rocks/docs/migration-guide

Akkie, thank you so much for your neat explanation in Silhouette migration guide. It allows me to move forward.