...
Scrollbar |
---|
...
Injection in Detail
...
Injection in Tapestry IoC can be a complicated subject for a number of reasons:
- Injection can occur in many places: on fields, and on parameters to methods and constructors of certain objects.
- Parts of Injection are themselves defined in terms of Tapestry IoC services, many of which are extensible.
Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
|
Despite this, injection generally Just Works: most of the time, you want Tapestry to inject a service, and only a single service implements the service interface.
...
As a chain-of-command, each of the following ObjectProviders will be considered and will attempt to identify the object to be injected.
Note |
---|
A common problem when extending injection is that contributions into the MasterObjectProvider configuration have to be handled carefully. Any dependencies of the contributed objects should be resolvable using only the early stages of the injection process, otherwise MasterObjectProvider will have to be instantiated in order to handle its own injection: Tapestry will detect this impossibility and throw an exception. In addition, thethe TypeCoercer serviceService is used by several ObjectProvider implementations, so the same restrictions apply to TypeCoercer service contributions. |
Value ObjectProvider
Checks for the presence of the @Value annotation. If present, then the annotation's value is evaluated (to expand any symbol references), and the TypeCoercer service is used to convert the resulting String to the injection type (the field or parameter type).
...
You may use the @InjectService annotation on component fields.
Scrollbar |
---|