tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel DEMEY (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (TAP5-1850) Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
Date Fri, 17 Feb 2012 09:03:59 GMT
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


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 : 

{code}
public static void bind(ServiceBinder binder) {
  binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
}
{code}

And after, I contributed to the ServiceOverride service, in order to specify the default implementation
of the ComponentMessagesSource interface : 

{code}
public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
@Local ComponentMessagesSource override) {
		
    configuration.add(ComponentMessagesSource.class, override);
		
}
{code}

But when I jetty:run my application, I have got this message error : 

{code}
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.
{code}

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

        

Mime
View raw message