This is one of Spring’s most basic concepts - management inversion.
You do not need to declare your dependencies using their implementation types (to avoid communication with the implementation). Instead, you can declare them using interfaces or superclasses and make Spring find the appropriate implementation class in context.
In other words, beans do not differ in their implementation classes, because you can change the bean implementation class without changing the beans that depend on it. If you want to distinguish between different beans of the same type, use logical bean instead:
@Autowired @Qualifier("smartCardWrapper") private SmartCardWrapper smardCardWrapper; @Autowired @Qualifier("dummySmartCardWrapper") private SmartCardWrapper dummySmardCardWrapper;
axtavt
source share