Injector for the Play applications that creates controller bindings on the fly.
Adds Scaldi support to the Global
.
Adds Scaldi support to the Global
.
If you mix-in ScaldiSupport
in the Global
, then you need to implement applicationModule
method:
override def applicationModule = new MyAppModule :: new AnotherModule
Implicit Injector
would be available in scope so you can use it in different play callbacks like onStart
and onStop
(ScaldiSupport
also extends Injectable
, so you can use inject
without any additional setup):
override def onStart(app: Application) = { super.onStart(app) val service = inject [Service] ... }
ScaldiSupport
provides following pre-defined bindings:
Dev
, Prod
or Test
)Provides some Play-specific conditions that can be used in the mappings:
Provides some Play-specific conditions that can be used in the mappings:
bind [MessageService] when (inDevMode or inTestMode) to new SimpleMessageService bind [MessageService] when inProdMode to new OfficialMessageService
Injector for the Play applications that creates controller bindings on the fly. The preferred way to use it is by adding it to the module composition at the very end, so that it would be possible to override default instantiation strategy in user-defined modules.
Here is an example: