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