Reputation: 1804
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?
Upvotes: 1
Views: 551
Reputation: 16158
Yes, you can go with @Qualifier
annotation. As you have 3 classes which implement same interface, name those classes with different names and use @Qualifier
annotation.
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.
Upvotes: 3