scaldi

play

package play

Visibility
  1. Public
  2. All

Type Members

  1. class ControllerInjector extends MutableInjectorUser with InjectorWithLifecycle[ControllerInjector] with ShutdownHookLifecycleManager

    Injector for the Play applications that creates controller bindings on the fly.

    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:

    object Global extends GlobalSettings with ScaldiSupport {
      def applicationModule = new UserModule :: new DbModule :: new ControllerInjector
    }
    

  2. class PlayAppModule extends Module

  3. trait ScaldiSupport extends GlobalSettings with Injectable

    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:

    • playApp - Current play application
    • playMode - Current play application's mode (Dev, Prod or Test)
    • config - Current play application's configuration (all properties of configuration are also available as bindings)

Value Members

  1. package condition

    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
    

Ungrouped