Stage of the new notes 3 2.Spring_06.Spring another use _6 Qualifier annotations


Copy the above data source to the following change to change the name

now is that there are two data sources


to create a database eesy02

find sql statement and then create the Account table

now there is even a library is equivalent to a eesy a eesy02 this is even a library.
There are three records account

eesy the five library data


to a data source address of the database was changed to 2 eesy02 library

perform the test class. Check out five records

if id here into ds2

run error will again test method


requires a corresponding bean ,. but found two bean

here to change ds1

This proves that even the library is eesy02


actually hiding here a Autowired comment. I want to follow up a type of injection. If there is no type of match. Or is there more than one match, and the parameter name can not be found for id time will be given in multiple matching.
This time, Qulifier played a role.




Annotations can appear on the parameters of

the actual development, indeed there may be a case where there are multiple objects implementation class

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11351487.html