@@ -153,17 +153,15 @@ Letting qualifier values select against target bean names, within the type-match
153
153
candidates, does not require a `@Qualifier` annotation at the injection point.
154
154
If there is no other resolution indicator (such as a qualifier or a primary marker),
155
155
for a non-unique dependency situation, Spring matches the injection point name
156
- (that is, the field name or parameter name) against the target bean names and chooses the
157
- same-named candidate, if any.
156
+ (that is, the field name or parameter name) against the target bean names and chooses
157
+ the same-named candidate, if any (either by bean name or by associated alias) .
158
158
159
159
Since version 6.1, this requires the `-parameters` Java compiler flag to be present.
160
160
====
161
161
162
- That said, if you intend to express annotation-driven injection by name, do not
163
- primarily use `@Autowired`, even if it is capable of selecting by bean name among
164
- type-matching candidates. Instead, use the JSR-250 `@Resource` annotation, which is
165
- semantically defined to identify a specific target component by its unique name, with
166
- the declared type being irrelevant for the matching process. `@Autowired` has rather
162
+ As an alternative for injection by name, consider the JSR-250 `@Resource` annotation
163
+ which is semantically defined to identify a specific target component by its unique name,
164
+ with the declared type being irrelevant for the matching process. `@Autowired` has rather
167
165
different semantics: After selecting candidate beans by type, the specified `String`
168
166
qualifier value is considered within those type-selected candidates only (for example,
169
167
matching an `account` qualifier against beans marked with the same qualifier label).
0 commit comments