title: How can I reference all components that implement a given interface?
body: <p>I am using the Apache Felix Service Component Runtime (SCR) on an Eclipse Equinox OSGi environment.</p>
  
  <p>There are several components declared that implement the interface <code>org.example.Producer</code> like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.example.ProducerA"&gt;
      &lt;implementation class="org.example.ProducerA"/&gt;
      &lt;service&gt;
          &lt;provide interface="org.example.Producer"/&gt;
      &lt;/service&gt;
  &lt;/scr:component&gt;
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.example.ProducerB"&gt;
      &lt;implementation class="org.example.ProducerB"/&gt;
      &lt;service&gt;
          &lt;provide interface="org.example.Producer"/&gt;
      &lt;/service&gt;
  &lt;/scr:component&gt;
  </code></pre>
  
  <p>Now in an other component I like to reference all those components that implement the interface <code>org.example.Producer</code> dynamically:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.example.ConsumerA"&gt;
      &lt;implementation class="org.example.ConsumerA"/&gt;
      &lt;reference bind="bindProducer" cardinality="0..n" interface="org.example.Producer" policy="dynamic" unbind="unbindProducer"/&gt;
      &lt;service&gt;
          &lt;provide interface="org.example.Consumer"/&gt;
      &lt;/service&gt;
  &lt;/scr:component&gt;
  </code></pre>
  
  <p>But this gives an error at runtime. It seems that the SCR includes a component name into its search filter:</p>
  
  <pre><code>!ENTRY org.eclipse.equinox.ds 1 0 2015-06-22 11:31:31.781
  !MESSAGE Could not bind a reference of component org.example.ConsumerA. The reference is: Reference[name = org.example.Producer, interface = org.example.Producer, policy = dynamic, cardinality = 0..n, target = null, bind = bindProducer, unbind = unbindProducer]
  </code></pre>
  
  <p>As you see in the error message it is searching explicitly for components with the name <code>org.example.Producer</code>. But none of the above listed components has that name (<code>org.example.ProducerA</code>, <code>org.example.ProducerB</code>).</p>
  
  <p>So the question is how can I reference components dynamically that provide implementations for a given interface by ignoring their names?</p>