Java Mailing List Archive

http://www.gg3721.com/

Home » users.tapestry »

[T5] Decorating Spring-defined services

Thiago H de Paula Figueiredo

2008-10-24

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi!

I've just tried many ways to decorate my UserController service, which is
defined via Spring. In other words: my decorate* method is never called
and therefore my service remains undecorated. Are non-Tapestry-IoC-defined
services not decoratable? Looking at the variables in the Eclipse
debugger, the injected UserController instance is a Spring proxy (I'm
using spring-tx), not like any Tapestry-IoC-defined service.

By the way, AspectDecorator is unbelievably awesome. :)

My attempts:

public static <T> T decorateUserController(UserController service,
AspectDecorator aspectDecorator) {
 ... // never executed
 // If I change UserController for any Tapestry-IoC-defined service,
 // this method is called.
}

public static <T> T decorateUserController(Class<T> serviceInterface, T
service,
   String serviceId, AspectDecorator aspectDecorator) {
 ... // never executed
}


@Match("User*")
public static <T> T decorateSomething(Class<T> serviceInterface, T service,
   String serviceId, AspectDecorator aspectDecorator) {
 ... // never executed
}

@Match("*")
public static <T> T decorateSomething(Class<T> serviceInterface, T service,
   String serviceId, AspectDecorator aspectDecorator) {
}

Throws this exception:
java.lang.IllegalStateException: Construction of service
'AssetObjectProvider' has failed due to recursion: the service depends on
itself in some way. Please check
org.apache.tapestry5.internal.services.AssetObjectProvider(AssetSource,
TypeCoercer, SymbolSource) (at AssetObjectProvider.java:45) via
org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at
TapestryModule.java:155) for references to another service that is itself
dependent on service 'AssetObjectProvider'.
 at
org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:52)
 at
org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:65)


--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.