class SimpleInjector extends Injector
A simple map backed injector.
This injector is intended for use by compile time injected applications in the transitional period between when Play fully supports dependency injection across the whole code base, and when some parts of Play still access core components through Play's global state. Since Play's global state requires that some components are still dynamically looked up from an injector, when using a compile time DI approach, there is typically no way to dynamically look up components, so this provides a simple implementation of the Injector trait to allow components that Play requires to be dynamically looked up.
It is intended to just hold built in Play components, but may be used to add additional components by end users when required.
The injector is an immutable structure, new components can be added using the +
convenience method, which returns
a new injector with that component included.
- Source
- Injector.scala
- Alphabetic
- By Inheritance
- SimpleInjector
- Injector
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
Value Members
- def +[T](component: T)(implicit ct: ClassTag[T]): SimpleInjector
Add a component to the injector.
- def add[T](clazz: Class[T], component: T): SimpleInjector
Add a component to the injector.
- def asJava: inject.Injector
Get as an instance of the Java injector.
Get as an instance of the Java injector.
- Definition Classes
- Injector
- def instanceOf[T](key: BindingKey[T]): T
Get an instance bound to the given binding key.
Get an instance bound to the given binding key.
- Definition Classes
- SimpleInjector → Injector
- def instanceOf[T](clazz: Class[T]): T
Get an instance of the given class from the injector.
Get an instance of the given class from the injector.
- Definition Classes
- SimpleInjector → Injector
- def instanceOf[T](implicit ct: ClassTag[T]): T
Get an instance of the given class from the injector.
Get an instance of the given class from the injector.
- Definition Classes
- SimpleInjector → Injector