Is there any way to inject bean dependencies make configurable except from factory pattern?
I have 3 class implement same interface and have 3 bean definition. I want to change that beans using in other class? For excample is it possile to read bean name form conf file and use it as varible?
Is there any way to inject bean dependencies make configurable except from factory pattern?
Share
Yes, you can go with
@Qualifierannotation. As you have 3 classes which implement same interface, name those classes with different names and use@Qualifierannotation.Spring documentation says :
autowiring by type may lead to multiple candidates, it is often necessary to have more control over the selection process. One way to accomplish this is with Spring's @Qualifier annotation.