With addInstance the exception is:

java.lang.IllegalStateException: Construction of service 'ServiceOverride' has 
failed due to recursion: the service depends on itself in some way. Please 
check org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(Map) (at 
ServiceOverrideImpl.java:31) via 
org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at 
TapestryIOCModule.java:49) for references to another service that is itself 
dependent on service 'ServiceOverride'.

On 31.01.2014, at 17:25, Dusko Jovanovski <[email protected]> wrote:

> try configuration.addInstance(AssetSource.class, MyAssetSourceImpl.class);
> 
> Here's the documentation for MappedConfiguration:
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/MappedConfiguration.html
> 
> 
> On Fri, Jan 31, 2014 at 5:05 PM, garz <[email protected]> wrote:
> 
>> Hi all,
>> 
>> i want to override the AssetSource service. I am doing it like described
>> in http://tapestry.apache.org/ioc-cookbook-overriding-ioc-services.htmllike 
>> this:
>> 
>>        @Contribute(ServiceOverride.class)
>>        public static void setupApplicationServiceOverrides(
>>                        MappedConfiguration<Class, Object> configuration) {
>>                configuration.add(AssetSource.class,
>> MyAssetSourceImpl.class);
>>        }
>> 
>> But the following error occurs:
>> Exception constructing service 'PageSource': Error invoking method public
>> org.apache.tapestry5.internal.services.PageSource
>> org.apache.tapestry5.internal.services.InternalModule.buildPageSource(org.apache.tapestry5.internal.services.PageSourceImpl,org.apache.tapestry5.services.InvalidationEventHub,org.apache.tapestry5.services.InvalidationEventHub):
>> Exception constructing service 'ComponentMessagesInvalidationEventHub':
>> Error invoking method public static
>> org.apache.tapestry5.services.InvalidationEventHub
>> org.apache.tapestry5.services.TapestryModule.buildComponentMessagesInvalidationEventHub(org.apache.tapestry5.services.messages.ComponentMessagesSource):
>> Exception constructing service 'ComponentMessagesSource': Error invoking
>> service contribution method
>> org.apache.tapestry5.services.TapestryModule.contributeComponentMessagesSource(AssetSource,
>> Resource, OrderedConfiguration): Cannot cast java.lang.Class to
>> org.apache.tapestry5.services.AssetSource
>> 
>> What needs to be done to override the AssetSource service?
>> 
>> Best regards

Reply via email to