Hi Tim, can you point me to the part of the spec that states that service configuration properties can be used to set such fields (e.g. target filter)? I just know that it works ;)
Best regards, Markus Tim Ward <tim.w...@paremus.com> schrieb am Mi., 15. Mai 2019, 15:45: > Declarative Services is amazing, so this is trivially easy to do. In this > case you should add the configuration property > > *service.target* > > > to your configuration dictionary with the value being an LDAP filter > selecting the service you want to inject. > > Note that “service” is the name of your reference (it defaults to the > field name) and that if your reference has a different name (e.g. if you > change the name of the field) then the name of the property will change too. > > For example: > > service.target=(foo=bar) > > > Inject me with a MyInterfaceB which has the service property foo equal to > bar. > > All the best, > > Tim > > On 15 May 2019, at 14:35, Matthias Leinweber < > matthias.leinwe...@ida-analytics.de> wrote: > > Hello Karaf Experts, > > i am trying to isolate services from each other. > > For Example you have a component: > > @Component( > configurationPid = "MyInterfacA.factory", > configurationPolicy = ConfigurationPolicy.REQUIRE, > public Class MyInterfaceAImpl implements MyInterfacA{ > > @Reference > MyInterfaceB service; > > ...} > > During runtime I create multiple services from type MyInterfaceB and > multiple componentes of MyInterfaceAImpl with configadmin. > Depending on the configuration of MyInterfaceAImpl I want to filter which > MyInterfaceB implementation is injected. > > I thought about FindHook but there I dont see a way how to get the > information which service from the bundle is requesting the reference. > > > Is there any chance to do this, or do I have to go for an alternative > design. Or a better way to isolate services from another? > > > Best regards, > Matthias > > >