Current this is not possible; the Spring context is instantiated
first, then the beans in it are "imported" as Tapestry IoC services.
We may see some improvements to this in 5.1.

Perhaps you could define an IoC version of a Spring bean whose
implementation is the Spring bean itself, you could then decorate the
IoC wrapper:

public SpringBeanInterface
buildSpringBeanWrapper(@InjectService("beanname") SpringBeanInterface
bean)
{
  return bean;
}

On Fri, Oct 24, 2008 at 11:18 AM, Thiago H. de Paula Figueiredo
<[EMAIL PROTECTED]> wrote:
> 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. :)

Thanks!  One of many hidden gems inside Tapestry!

>
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to