Silhouette 4.0.0 Is it possible to use silhouette without runtime DI?


#1

I am looking for a way to manually setup silhouette module to perform compile time DI instead of runtime guice DI. Is it possible ? have you example to show me ?
Thx for your response.


#2

That works fine; I do precisely that.

Here’s how I do that, in the LoginWithOpenAuthController:
https://github.com/debiki/talkyard/blob/67c11a773f8975410663b41723ece21214076e1c/app/controllers/LoginWithOpenAuthController.scala#L55

And here, in the same file, is where all login providers (Google, Facebook, GitHub etc) are created.

Here’s where all controllers are wired together, with compile time dependency injection: https://github.com/debiki/talkyard/blob/67c11a773f8975410663b41723ece21214076e1c/app/ed/server/EdAppLoader.scala#L85


#3

For information, i find how to bypass the automatic binding, it is to disable play modules.

play.modules.disabled += "com.mohiva.play.silhouette.api.actions.SecuredErrorHandlerModule"
play.modules.disabled += "com.mohiva.play.silhouette.api.actions.SecuredActionModule"
play.modules.disabled += "com.mohiva.play.silhouette.api.actions.SecuredErrorHandlerModule"
play.modules.disabled += "com.mohiva.play.silhouette.api.actions.UnsecuredActionModule"
play.modules.disabled += "com.mohiva.play.silhouette.api.actions.UnsecuredErrorHandlerModule"
play.modules.disabled += "com.mohiva.play.silhouette.api.actions.UserAwareActionModule"