[
https://issues.apache.org/jira/browse/CAMEL-6130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13594821#comment-13594821
]
Claus Ibsen commented on CAMEL-6130:
------------------------------------
You can use this method and provide null as the class
http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#getServiceReferences(java.lang.Class,
java.lang.String)
Frankly the end user has not provided any class but only the name of the bean
to use. So if the service is register with class FooImpl.class, and we want to
lookup this service using the name "foo", then we should be able to do
getServiceReferences(null, "foo");
If the setter type is a Foo (eg the interface) then Camel (with your patch)
would call
getServiceReferences(Foo.class, "foo");
But what happens if the service was registered with
FooImpl.class as the class type.
Would the OSGi service registry be smart enough to know that FooImpl and Foo is
the "same"
> EndpointHelper.setReferenceProperties() does not work with OSGiServiceRegistry
> ------------------------------------------------------------------------------
>
> Key: CAMEL-6130
> URL: https://issues.apache.org/jira/browse/CAMEL-6130
> Project: Camel
> Issue Type: Bug
> Components: osgi
> Affects Versions: 2.9.5, 2.10.4
> Reporter: Aaron Whiteside
> Priority: Critical
> Fix For: 2.9.7, 2.10.5, 2.11.0
>
> Attachments: CAMEL-6130.patch
>
>
> EndpointHelper.setReferenceProperties() does not work with OSGiServiceRegistry
> setReferenceProperties() is hard-coded to lookup services of type
> Object.class.
> It should use reflection to determine the type that the setter method accepts
> and then use that type to lookup the reference in the service registry.
> At the moment this issue is stopping #bean references in Endpoints from being
> resolved when using an OSGiServiceRegistry, in OSGi you need to know the
> class of the service you want before hand.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira