Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

 

 

Deprecated
messageUse ServiceOverrides instead. Aliases will be removed starting in 5.3.
since5.2
 

Div
stylefloat:right
titleRelated Articles
classaui-label
Content by Label
showLabelsfalse
showSpacefalse
titleRelated Articles
cqllabel = "request-processing" and space = currentSpace()

 

See Aliases IoC Cookbook - Overriding IoC Services

Introduction

Tapestry goes to great lengths so that you can use the Inject annotation on a field and provide no additional data, yet end up with the correct object or service.

...

You can then contribute into the Infrastructure service's configuration:

Code Block
languagejava
titleAppModule.java (partial)
public static void contributeAlias(@InjectService("MyService") MyService myService,
        Configuration<AliasContribution> configuration)
{
    configuration.add(AliasContribution.create(MyService.class, myService));
}

...

Notice that the contribution doesn't _have_ to be a service; you can just instantiate an object inside the contribution method and contribute that. That's what we're doing in the example, though we're using a create() static method rather than *new* (just to smooth out some Java Generics ugliness).

...