5. Resource annotation parsing, 5. resource Annotation
Resource can be used in two scenarios:
1. Resource
When a Resource is not followed by a parameter, it is directed to applicationContext Based on the attribute name it is annotated. in the xml file, check whether the bean id matches it. If yes, assign the corresponding class to it,
If no value is available, it is matched to the configuration file based on the annotation attribute type. If yes, it is assigned a value. If no value exists, an error is returned.
2. Resource (name = "")
If the Resource is followed by a name parameter, it is directly matched with the bean id based on the name value. If yes, the value is assigned. If no, an error is returned.
Resource is a java Native annotation, and the spring framework also provides Autowired and Qualifer annotations,
Autowired matches by type, while Qualifer matches by attribute name.