...
Decoration has been replaced, in Tapestry 5.1, with advice Service Advice, which is a simpler mechanism for accomplishing the same thing.
...
Code Block | ||||
---|---|---|---|---|
| ||||
package org.example.myapp.services;
import org.apache.tapestry5.ioc.services.LoggingDecorator;
import org.slf4j.Logger;
public class MyAppModule
{
public static Indexer build(Logger logger, LoggingDecorator decorator)
{
return decorator.build(Indexer.class, logger, new IndexerImpl());
}
} |
But as we'll see, its possible to have a single decorator method work on many different services by using annotations.
...
Targeting Multiple Services
By using the @Match @Match annnotation, you may identify which services are to be decorated.
...
In cases where multiple decorators will apply to a single service, you can control the order in which decorators are applied using an additional annotation: @Order@Order.
This annotation allows any number of ordering constraints to be specified for the decorator, to order it relative to any other decorators.
...