jeudi 10 août 2017

autowire a list of beans and identify them seperately

i can autowire a list of service beans in spring boot but i need a way to pick the one i need using the name they have given.

@Service("myService")
public class DefaultService implements MyService {
}

@Service("myService2")
public class DefaultService2 implements MyService {
}


@Autowire
List<MyService> services;

is it possible to get DefaultService2 and DefaultService seperately.




Aucun commentaire:

Enregistrer un commentaire