@@ -4281,16 +4281,16 @@ any). These types must be 'wired up' explicitly via XML or using a Spring `@Bean
4281
4281
4282
4282
4283
4283
[[beans-autowired-annotation-primary]]
4284
- === Fine-tuning annotation-based autowiring with primary
4285
- Because autowiring by type may lead to multiple candidates, it is often necessary to
4286
- have more control over the selection process. One way to accomplish this is with
4287
- Spring's `@Primary` annotation. `@Primary` indicates that a bean should be given
4288
- preference when multiple candidates are qualified to autowire a single-valued dependency.
4289
- If exactly one 'primary' bean exists among the candidates, it will be the autowired
4290
- value.
4284
+ === Fine-tuning annotation-based autowiring with @Primary
4285
+ Because autowiring by type may lead to multiple candidates, it is often necessary to have
4286
+ more control over the selection process. One way to accomplish this is with Spring's
4287
+ `@Primary` annotation. `@Primary` indicates that a particular bean should be given
4288
+ preference when multiple beans are candidates to be autowired to a single-valued
4289
+ dependency. If exactly one 'primary' bean exists among the candidates, it will be the
4290
+ autowired value.
4291
4291
4292
- Let's assume the following configuration that define `firstMovieCatalog` as the _primary_
4293
- `MovieCatalog`
4292
+ Let's assume we have the following configuration that defines `firstMovieCatalog` as the
4293
+ _primary_ `MovieCatalog`.
4294
4294
4295
4295
[source,java,indent=0]
4296
4296
[subs="verbatim,quotes"]
@@ -4310,7 +4310,8 @@ Let's assume the following configuration that define `firstMovieCatalog` as the
4310
4310
}
4311
4311
----
4312
4312
4313
- With such configuration, `MovieRecommender` will use `firstMovieCatalog`
4313
+ With such configuration, the following `MovieRecommender` will be autowired with the
4314
+ `firstMovieCatalog`.
4314
4315
4315
4316
[source,java,indent=0]
4316
4317
[subs="verbatim,quotes"]
@@ -4444,14 +4445,14 @@ optional semantic qualifiers. This means that qualifier values, even with the be
4444
4445
fallback, always have narrowing semantics within the set of type matches; they do not
4445
4446
semantically express a reference to a unique bean id. Good qualifier values are "main"
4446
4447
or "EMEA" or "persistent", expressing characteristics of a specific component that are
4447
- independent from the bean id , which may be auto-generated in case of an anonymous bean
4448
+ independent from the bean `id` , which may be auto-generated in case of an anonymous bean
4448
4449
definition like the one in the preceding example.
4449
4450
4450
4451
Qualifiers also apply to typed collections, as discussed above, for example, to
4451
4452
`Set<MovieCatalog>`. In this case, all matching beans according to the declared
4452
4453
qualifiers are injected as a collection. This implies that qualifiers do not have to be
4453
4454
unique; they rather simply constitute filtering criteria. For example, you can define
4454
- multiple `MovieCatalog` beans with the same qualifier value "action"; all of which would
4455
+ multiple `MovieCatalog` beans with the same qualifier value "action", all of which would
4455
4456
be injected into a `Set<MovieCatalog>` annotated with `@Qualifier("action")`.
4456
4457
4457
4458
[TIP]
0 commit comments