Spring-configuration: I have created 2 beans with reference to same class but different database sessions.
<bean id="abc1" class="abc">
<bean id="abc2" class="abc">
Now is there any way to set bean with id "abc1" as default bean for autowiring and use abc2 for autowiring when mentioned explicitly like this:
@Autowiring
@Qualifier("abc2")
private abc obj;
Solution:
<bean id="abc1" class="abc" primary="true">
makes abc1 default one to be autowired.
for creating an instance of abc2, we can use this:
@Autowired
@Qualifier("abc2")
private abc obj;
Aucun commentaire:
Enregistrer un commentaire