You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Christian Köberl (Commented JIRA)" <ji...@apache.org> on 2012/03/13 14:23:38 UTC
[jira] [Commented] (TAP5-1850) Impossible to override the
ComponentMessagesSource service, by using the ServiceOverride service
[ https://issues.apache.org/jira/browse/TAP5-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13228378#comment-13228378 ]
Christian Köberl commented on TAP5-1850:
----------------------------------------
There is a workaround - you can decorate ComponentMessagesSource:
@Match("ComponentMessagesSource")
public static ComponentMessagesSource decorateComponentMessagesSource (ComponentMessagesSourcedelegate)
{
return new MyComponentMessagesSource(delegate);
}
See also: http://tapestry.1045711.n5.nabble.com/T5-Expanding-Messages-Catalog-for-localization-from-arbitrary-source-td2420856.html
> Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
> ------------------------------------------------------------------------------------------------
>
> Key: TAP5-1850
> URL: https://issues.apache.org/jira/browse/TAP5-1850
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-core
> Affects Versions: 5.3
> Reporter: Emmanuel DEMEY
> Priority: Blocker
> Attachments: tapestry.zip
>
>
> I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service.
> I would like to override the default implementation of the ComponentMessagesSource service. So first, I added this new implementation by using the ServiceBinder :
> public static void bind(ServiceBinder binder) {
> binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
> }
> And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface :
> public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
> @Local ComponentMessagesSource override) {
>
> configuration.add(ComponentMessagesSource.class, override);
>
> }
> But when I jetty:run my application, I have got this message error :
> Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
> So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface.
> Here is the email sent to me by Howard :
> There is a definite bug here, and it is related to
> ComponentMessagesSource ... or, more specifically,
> ApplicationMessageCatalogObjectProvider (which is what allows services
> to inject a Messages instance and get a localized version of the
> application messages). ObjectProviders, contributed to the
> MasterObjectProvider service, are part of the general injection
> infrastructure, and thus have the be very tricky to prevent unintended
> dependency loops. Even so, it should be possible to fix this with a
> little recoding
> Thanks
> Manu
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira