[
https://issues.apache.org/jira/browse/FELIX-5337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15440163#comment-15440163
]
Pierre De Rop commented on FELIX-5337:
--------------------------------------
Jan Willem, there is a work around:
if you uses a ServiceRefernce in the method signature, instead of Object, then
it should work:
{code}
@Component
public class CatchAll {
@ServiceDependency(filter="(objectClass=*)", required = false)
void addService(ServiceReference service) {
System.out.println("Got service " + service);
}
}
{code}
In this case, the runtime does not infer any service dependency type from the
method signature, and internally does this, which works:
{code}
createServiceDependency().setService("(objectClass=*)").setRequired(false).setCallbacks(...)
{code}
I will continue to investigate in order to see if a fix can be done (probably
in the dm core, not in the runtime).
> Filter-based dependencies working differently for annotations
> -------------------------------------------------------------
>
> Key: FELIX-5337
> URL: https://issues.apache.org/jira/browse/FELIX-5337
> Project: Felix
> Issue Type: Bug
> Affects Versions: dependencymanager-4.3.0
> Reporter: J.W. Janssen
> Assignee: Pierre De Rop
>
> I've got a "catch all" service dependency that simply wants to see *all*
> services being registered. In the activator based implementation I simply
> express my dependency as
> {{createServiceDependency().setService("(objectClass=*)").setRequired(false).setCallbacks("addService",
> "removeService")}} and I get all services I'm interested in (I mean: each
> and every registered service).
> However, if I rewrite my code to use annotations using
> {{@ServiceDependency(filter="(objectClass=*)", required = false, removed =
> ...)}}, I suddenly do not see all services I expect: only services that seem
> to be compatible with the class-space of the bundle my code lives in.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)