Spring5 analysis of the source code AnnotationConfigApplicationContext

Use @Qualifier annotated with @Primary

Spring ApplicationContext role in

BeanFactory and ApplicationContext difference

AnnotationConfigApplicationContext start Principle Analysis

 

Suppose two IUser implementation class and UserImpl2 UserImpl1

1. @Autowired + @Qualifier ( "UserImpl1") can specify which implementation class to use. Can also @Resource ( "UserImpl1")

2. @Primary who is designated to load, used in the implementation class. Specified.

 

Guess you like

Origin www.cnblogs.com/toov5/p/11223463.html