I am quite new to spring framework and came across the following issue.
I have an interface ClassA
, which is implemented by classed ClassA1
You could use the @Qualifier
annotation:
@Autowired
@Qualifier("class1")
ClassA classA1;
@Autowired
@Qualifier("class2")
ClassA classA2;
Ref: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-autowired-annotation-qualifiers
or the @Resource
annotation:
@Resource(name="class1")
ClassA classA1;
@Resource(name="class2")
ClassA classA2;
Ref: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-resource-annotation