Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added "Related Articles" box (using "configuration" label), added API links for more annoations, added "content under development" for incomplete sections
Table of Contents
Wiki Markup
{float:right|background=#eee}
{contentbylabel:title=Related Articles|showLabels=false|showSpace=false|space=@self|labels=configuration}
{float}

The Application Module class is a plain Java class. A system of annotations and naming conventions allows Tapestry to determine what services are provided by the module to your application. This is the place where you bind your custom implementation of services, contribute to, decorate and override existing services.

...

Note

Allowing for non-static methods may have been a design error, a kind of premature optimization. The thinking was that the module could have common dependencies that it could then easily access when building services. This was partly about runtime efficiency but mostly about reducing redundancy in the various service building, contribution, and decorating methods; the ServieBinder ServiceBinder came later, and was a better solution (trading runtime efficiency for developer ease of use).

...

Tapestry has evolved some additional tools to "have your cake and eat it too"; the @Autobuild @Autobuild annotation takes care of instantiating a service implementation, with dependencies, allowing your code to focus on the extra initialization logic, and not on the dependencies:

...

Services will be annotated with @UsesConfiguration@UsesConfiguration.

For example, here's a kind of tapestry internal service that requires a list of Coercion tuples to be able to coerce values from one type to another (i.e. from string to the target type when reading values from the Http HTTP request)

Code Block
public TypeCoercerImpl(Collection<CoercionTuple> tuples)
{
    // ...
}

...

Code Block
public static void contributeTypeCoercer(Configuration<CoercionTuple> configuration) {
{
    // Create Coercion tuple here
    // ...

    configuration.add(myTuple);
}

Decorate methods

content under development

Annotations

Main Article: Annotations

Tapestry 5.2 comes with a set of of annotation annotations to better your understanding of module classes.

content under development

Anchor
parameter-types
parameter-types
Parameter types

...

Configuration parameter types

content under development

Link to services

content under development

Symbols

Main Article: Symbols

content under development

Load services on registry startup

content under development

Define service scope

content under development

Disambiguate services

content under development

With service Id

content under development

With Markers

content under development

Override existing services

content under development