play.api

inject

package inject

Play's runtime dependency injection abstraction.

Play's runtime dependency injection support is built on JSR-330, which provides a specification for declaring how dependencies get wired to components. JSR-330 however does not address how components are provided to or located by a DI container. Play's API seeks to address this in a DI container agnostic way.

The reason for providing this abstraction is so that Play, the modules it provides, and third party modules can all express their bindings in a way that is not specific to any one DI container.

Components are bound in the DI container. Each binding is identified by a BindingKey, which is typically an interface that the component implements, and may be optionally qualified by a JSR-330 qualifier annotation. A binding key is bound to a BindingTarget, which describes how the implementation of the interface that the binding key represents is constructed or provided. Bindings may also be scoped using JSR-330 scope annotations.

Bindings are provided by instances of Module.

Out of the box, Play provides an implementation of this abstraction using Guice.

See also

The Module class for information on how to provide bindings.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. inject
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait ApplicationLifecycle extends AnyRef

    Application lifecycle register.

  2. final case class Binding[T](key: BindingKey[T], target: Option[BindingTarget[T]], scope: Option[Class[_ <: Annotation]], eager: Boolean, source: AnyRef) extends Product with Serializable

    A binding.

  3. final case class BindingKey[T](clazz: Class[T], qualifier: Option[QualifierAnnotation]) extends Product with Serializable

    A binding key.

  4. final case class BindingKeyTarget[T](key: BindingKey[_ <: T]) extends BindingTarget[T] with Product with Serializable

    A binding target that is provided by another key - essentially an alias.

  5. sealed trait BindingTarget[T] extends AnyRef

    A binding target.

  6. class BuiltinModule extends Module

    The Play BuiltinModule.

  7. class ConfigurationProvider extends Provider[Configuration]

  8. final case class ConstructionTarget[T](implementation: Class[_ <: T]) extends BindingTarget[T] with Product with Serializable

    A binding target that is provided by a class.

  9. class DefaultApplicationLifecycle extends ApplicationLifecycle

    Default implementation of the application lifecycle.

  10. trait Injector extends AnyRef

    An injector, capable of providing components.

  11. abstract class Module extends AnyRef

    A Play dependency injection module.

  12. class PluginsProvider extends Provider[Plugins]

    Annotations
    @Singleton()
  13. final case class ProviderConstructionTarget[T](provider: Class[_ <: Provider[T]]) extends BindingTarget[T] with Product with Serializable

    A binding target that is provided by a provider class.

  14. final case class ProviderTarget[T](provider: Provider[_ <: T]) extends BindingTarget[T] with Product with Serializable

    A binding target that is provided by a provider instance.

  15. sealed trait QualifierAnnotation extends AnyRef

    A qualifier annotation.

  16. final case class QualifierClass[T <: Annotation](clazz: Class[T]) extends QualifierAnnotation with Product with Serializable

    A qualifier annotation class.

  17. final case class QualifierInstance[T <: Annotation](instance: T) extends QualifierAnnotation with Product with Serializable

    A qualifier annotation instance.

  18. class RoutesProvider extends Provider[Router]

    Annotations
    @Singleton()
  19. class SimpleInjector extends Injector

    A simple map backed injector.

Value Members

  1. object BindingKey extends Serializable

    Constructor for a binding Key that doesn't have a qualifier.

  2. object Modules

    Locates and loads modules from the Play environment.

  3. object NewInstanceInjector extends Injector

    An injector that simply creates a new instance of the passed in classes using the classes no-arg constructor.

  4. def bind[T](implicit arg0: ClassTag[T]): BindingKey[T]

    Create a binding key for the given class.

    Create a binding key for the given class.

    See also

    The Module class for information on how to provide bindings.

  5. def bind[T](clazz: Class[T]): BindingKey[T]

    Create a binding key for the given class.

    Create a binding key for the given class.

    See also

    The Module class for information on how to provide bindings.

  6. package guice

Inherited from AnyRef

Inherited from Any

Ungrouped