I have some services implementing same Interface. I want to use service dynamically according to a paramater from database.
I would like use CDI annotation but if not possible please tell me how i can achieve it ? a factory ?
We have several providers with service associated and following the rule in DB we will use service or other
Service1 implements IService1, IGeneralService{
public void run(){...};}
Service2 implements IService2, IGeneralService{
public void run(){...};}
then i will use it according to DB parameter like a country or other.
public class Test{
@IGeneralService service;
public void getRunMethod(String numberService){
service.run() (here it run the right service)
}
}
something like that. Any idea ?