Re: Conditional service override

2013-03-01 Thread Thiago H de Paula Figueiredo
On Fri, 01 Mar 2013 01:30:38 -0300, Alex Kotchnev wrote: Thiago - I can probably try going the decoration route, although it feels a little bit "not right" -conceptually I want to 'override' the original implementation. It may not feel 100% right, but a decorator is still a different

Re: Conditional service override

2013-03-01 Thread Ivan Khalopik
There is a helper method in configuration classes for service autobuilding: configuration.addInstance(FooService.class, DevFooService.class); But I think autobuilding inside service override contribution is not a good idea as it can result in recursion if service has complex dependency tree. The

Re: Conditional service override

2013-02-28 Thread Alex Kotchnev
One other thing that I tried was to instantiate the "overriding" class inside of the overriding method instead of providing a builder method to create an overriding service, e.g. : @Contribute(ServiceOverride.class) public static void setupApplicationServiceOverrides(MappedConfiguration config

Re: Conditional service override

2013-02-28 Thread Thiago H de Paula Figueiredo
On Thu, 28 Feb 2013 19:34:17 -0300, Alex Kotchnev wrote: I would like to be able to conditionally override a service inside of a tapestry module (e.g. in the case of DevelopmentModule) Sometimes, instead of contributing to ServiceOverrides, using a decorator method works better. You don't

Re: Conditional service override

2013-02-28 Thread Taha Siddiqi
Hi Alex How about instantiating the service inside the override contribution method. configuration.add(FooService.class, objectLocator.autobuild(MyOtherImplementation.class)); regards Taha On Mar 1, 2013, at 4:04 AM, Alex Kotchnev wrote: > I would like to be able to conditionally override a s