Language: Scala; Framework: Play 2.5; Libraries: Silhouette 4.0, Guice, scala-guice.
One of the official Silhouette seed projects uses guice and scala-guice (net.codingwell.scalaguice.ScalaModule) to write DI configuration. Code looks like this:
import net.codingwell.scalaguice.ScalaModule
class Module extends AbstractModule with ScalaModule{
/**
* Configures the module.
*/
def configure() {
bind[Silhouette[MyEnv]].to[SilhouetteProvider[MyEnv]]
bind[SecuredErrorHandler].to[ErrorHandler]
bind[UnsecuredErrorHandler].to[ErrorHandler]
bind[IdentityService[User]].to[UserService]
I wonder, how would this code look like without magic from net.codingwell.scalaguice library. Could someone re-write these bindings using only original guice ?
in addition I have also this code:
@Provides
def provideEnvironment(
userService: UserService,
authenticatorService: AuthenticatorService[CookieAuthenticator],
eventBus: EventBus
): Environment[MyEnv] = {
Environment[MyEnv](
userService,
authenticatorService,
Seq(),
eventBus
)
}
Thanks in advance.