Application lifecycle register.
A binding.
A binding.
Bindings are used to bind classes, optionally qualified by a JSR-330 qualifier annotation, to instances, providers or implementation classes.
Bindings may also specify a JSR-330 scope. If, and only if that scope is javax.inject.Singleton, then the binding may declare itself to be eagerly instantiated. In which case, it should be eagerly instantiated when Play starts up.
The binding key.
The binding target.
The JSR-330 scope.
Whether the binding should be eagerly instantiated.
Where this object was bound. Used in error reporting.
A binding key.
A binding key.
A binding key consists of a class and zero or more JSR-330 qualifiers.
The class to bind.
An optional qualifier.
A binding target that is provided by another key - essentially an alias.
A binding target.
A binding target.
This trait captures the four possible types of targets.
A binding target that is provided by a class.
Default implementation of the application lifecycle.
Default implementation of the application lifecycle.
An injector, capable of providing components.
An injector, capable of providing components.
This is an abstraction over whatever dependency injection is being used in Play. A minimal implementation may only
call newInstance
on the passed in class.
This abstraction is primarily provided for libraries that want to remain agnostic to the type of dependency injection being used. End users are encouraged to use the facilities provided by the dependency injection framework they are using directly, for example, if using Guice, use com.google.inject.Injector instead of this.
A Play dependency injection module.
A Play dependency injection module.
Dependency injection modules can be used by Play plugins to provide bindings for JSR-330 compliant ApplicationLoaders. Any plugin that wants to provide components that a Play application can use may implement one of these.
Providing custom modules can be done by creating a resource on the classpath called play.modules
. This file is
expected to contain a list of module classes, one class per line. For example:
com.example.FooModule com.example.BarModule
It is strongly advised that in addition to providing a module for JSR-330 DI, that plugins also provide a Scala trait that constructs the modules manually. This allows for use of the module without needing a runtime dependency injection provider.
The bind
methods are provided only as a DSL for specifying bindings. For example:
def bindings(env: Environment, conf: Configuration) = Seq( bind[Foo].to[FooImpl], bind[Bar].to(new Bar()), bind[Foo].qualifiedWith[SomeQualifier].to[OtherFoo] )
A binding target that is provided by a provider class.
A binding target that is provided by a provider instance.
A qualifier annotation.
A qualifier annotation.
Since bindings may specify either annotations, or instances of annotations, this abstraction captures either of those two possibilities.
A qualifier annotation class.
A qualifier annotation instance.
A simple map backed injector.
A simple map backed injector.
This injector is intended for use 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.
It is intended to just hold built in Play components, but may be used to add additional components by end users when required.
An injector that simply creates a new instance of the passed in classes using the classes no-arg constructor.
Application lifecycle register.
This is used to hook into Play lifecycle events, specifically, when Play is stopped.
Stop hooks are executed when the application is shutdown, in reverse from when they were registered.
To use this, declare a dependency on ApplicationLifecycle, and then register the stop hook when the component is started.