Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fix broken links

...

A key concept in Tapestry is the use of injection. The Tapestry IoC container makes use of one form of injection, via parameters to service builder methods.

For components, Tapestry takes a completely different tack: injection directly into instance variables.

Inject Annotation

The Inject annotation is used to identify fields that will contain injected services and other resources.

...

In addition, there are a few special cases that are triggered by specific field types, or additional annotations, in addition, to Inject, on a field.

Asset Injection

When the Path annotation is also present, then the injected value (relative to the component) will be a localized asset.

...

Block Injection

For field type Block, the value of the Inject annotation is the id of the <block> element within the component's template. Normally, the id of the block is determined from the field name (after stripping out leading "_" and "$" characters). Where that is not appropriate, an Id annotation can be supplied:

...

A very common example occurs when a component needs access to its resources. The component can define a field of the appropriate type and use the Inject annotation without a value:

...

Here, a specific object is requested. A Service annotation is used to identify the service name.

...

Annonymous injection is controlled by the InjectionProvider service. The configuration for this service is a chain of command for handling component injections.