I have created a interface . Which two different services are implementing .
Consider I have a interface named CheckReference and two different classes
CheckReferenceImpl1 and
Check ReferencImpl2 .
@Component
@Service(value = CheckReference.class)
@Property(name = "domain", value = "ref1")
public class CheckReferenceImpl1 implements CheckReference
Also ,
@Component
@Service(value = CheckReference.class)
@Property(name = "domain", value = "ref2")
public class CheckReferenceImpl2 implements CheckReference
Now I want to dynamically load the implementation depending on my need using
@Reference annotation dynamically.
So , In a check condition
public class LoadReference {
@Reference
CheckReference checkReference
if(check) {
// load checkReferencImpl1
} else {
// load checkReferenceImpl2
}
}
Also I know that I can use target property to load specific implemenation.
But that is static way.
But in order to do this dynamically , Not able to relate from specifications
and tutorials how should I do this ??
--
View this message in context:
http://apache-felix.18485.n6.nabble.com/Dynamically-referencing-a-Service-using-Felix-annotations-tp4999472.html
Sent from the Apache Felix - Dev mailing list archive at Nabble.com.