Binding is defined in a Module
as Type -> instance relationship (sometimes
with additional identifiers).
Binding is defined in a Module
as Type -> instance relationship (sometimes
with additional identifiers).
I can be injected in classes where implicit Injector
is available.
Binding can be defined (containing a value) or undefined.
Bindings with lifecycle may have initialization and destruction handlers
Helper class to make injection with default value more readable.
Same as module, but with accessible Injectable
's methods.
Entities that extend Identifiable
can be identified using Scaldi identifiers.
Entities that extend Identifiable
can be identified using Scaldi identifiers.
They can also contain conditions.
Helper class to make injection by identifier more readable.
Helper class to make injection by identifier more readable.
type of the dependency being injected
A wrapper for a default value for the injection and for its identifiers.
A wrapper for a default value for the injection and for its identifiers.
It is here to make injection constraints look like natural language.
type of the dependency being injected
default value for injected instance. It would be used if biding is not found in the Injector
.
identifiers
Provides injection DSL.
Provides injection DSL. You can extend it in your classes in order to use inject methods.
The only responsibility of this trait is to provide you with inject function (so it just provides nice syntax for injecting dependencies).
In order to actually find and inject dependencies, inject
method always
takes an implicit parameter of type Injector
.
Example:
Application (implicit inj: Injector) extends Injectable { protected val db = inject [Database] // database can now be used as an instance of Database class` }
Binding that is initialized on on first use and never changes afterwards.
Binding that is initialized on on first use and never changes afterwards.
function that creates and returns value that will be associated with binding
binding's identifiers (empty by default)
binding's conditions (empty by default)
binding's lifecycle (empty by default)
Module is a place where you declare your bindings.
Module is a place where you declare your bindings. It's also the most common injector that you can use in most cases. It's a mutable injector so it can have a lifecycle and it also provides nice DSL for the bindings.
Module is an Injectable instance thanks to that you can inject other dependencies in module's bindings.
Binding that is initialized at the Injector initialization phase (normally during an application startup) and never changes afterwards.
Binding that is initialized at the Injector initialization phase (normally during an application startup) and never changes afterwards.
function that creates and returns value that will be associated with binding
binding's identifiers (empty by default)
binding's conditions (empty by default)
binding's lifecycle (empty by default)
Exactly the same as Injectable trait, but with all methods made public
Used to look for simple bindings in supplied properties (hash table)
Binding that is initialized on every injection with createFn function.
Binding that is initialized on every injection with createFn function.
function that creates and returns value that will be associated with binding
binding's identifiers (empty by default)
binding's conditions (empty by default)
binding's lifecycle (empty by default)
Binding with a raw value, not converted to any specific type (value from system properties, configuration, etc.).
Binding with a raw value, not converted to any specific type (value from system properties, configuration, etc.).
value of the binding
identifiers defining the binding
Abstract Injector
implementation that may be extended by other injectors that get values from
specific source (command line, typesafe config, properties, etc.)
Binding that only contains a value.
Binding that only contains a value. As it is just a fixed value, no lyfecycle is needed
binding's type
binding's value
binding's identifiers (empty by default)
binding's conditions (empty by default)
if binding should be cacheable (false by default)
if binding is eager (non lazy) (false by default)
Container that transforms a list of bindings into a valid Injector
Injector with bindings found in supplied typesafe configuration
(Since version 0.5) BindingProvider is deprecated and will be removed soon. As an alternative you can use ImmutableWrapper
injector to define an immutability boundary in composition or create your own injector that is marked as ImmutableInjector
.
(Since version 0.5) ReflectionBinder is deprecated and will be removed soon. As an alternative you can use WordBinder
or create your own injector that is marked as ImmutableInjector
.
(Since version 0.5)
Factory for creating injector from command line arguments
Companion object of Injectable which can be just imported in contrast to Injectable trait which always need to be extended.
Companion object of Injectable which can be just imported in contrast to Injectable trait which always need to be extended. After importing it, you can use an injection DSL without extending the trait.
Example:
import scaldi.Injectable._ val database = inject [Database]
Empty injector, used for injector combination or as a filler where injector is required, but there are no bindings.
Factories to handle different type of properties' source.
Used to look up for simple bindings in system properties.
Factories to handle different type of Typesafe config's source.
Scaldi - is Scala dependency injection library. Basically Scala already have everything you need for dependency injection. But still some things can be made easier. Goal of the project is to provide more standard and easy way to make dependency injection in Scala projects consuming power of the Scala language. With Scaldi you can define your application modules in pure Scala without any annotations or XML.
For more information see: http://olegilyenko.github.com/scaldi/Scaldi.html