Spring @Resource, @Autowired, @Qualifier difference

@Resource assembles the injection according to the name by default. Only when a bean matching the name is not found, it will assemble the injection according to the type;

@Autowired is injected by type assembly by default. If you want to transfer injection by name, you need to use it in conjunction with @Qualifier;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325138713&siteId=291194637