Skip to content

Commit 2622db1

Browse files
committed
Consistent references to annotation-based autowiring
1 parent 3dac274 commit 2622db1

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

framework-docs/modules/ROOT/pages/core/beans/classpath-scanning.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ exposed based on security policies in some environments -- for example, standalo
317317
JDK 1.7.0_45 and higher (which requires 'Trusted-Library' setup in your manifests -- see
318318
{stackoverflow-questions}/19394570/java-jre-7u45-breaks-classloader-getresources).
319319
320-
On JDK 9's module path (Jigsaw), Spring's classpath scanning generally works as expected.
321-
However, make sure that your component classes are exported in your `module-info`
320+
On the module path (Java Module System), Spring's classpath scanning generally works as
321+
expected. However, make sure that your component classes are exported in your `module-info`
322322
descriptors. If you expect Spring to invoke non-public members of your classes, make
323323
sure that they are 'opened' (that is, that they use an `opens` declaration instead of an
324324
`exports` declaration in your `module-info` descriptor).
@@ -751,7 +751,7 @@ and bean definition show.
751751
TIP: If you run into naming conflicts due to multiple autodetected components having the
752752
same non-qualified class name (i.e., classes with identical names but residing in
753753
different packages), you may need to configure a `BeanNameGenerator` that defaults to the
754-
fully qualified class name for the generated bean name. As of Spring Framework 5.2.3, the
754+
fully qualified class name for the generated bean name. The
755755
`FullyQualifiedAnnotationBeanNameGenerator` located in package
756756
`org.springframework.context.annotation` can be used for such purposes.
757757

@@ -920,7 +920,8 @@ Kotlin::
920920
[[beans-scanning-qualifiers]]
921921
== Providing Qualifier Metadata with Annotations
922922

923-
The `@Qualifier` annotation is discussed in xref:core/beans/annotation-config/autowired-qualifiers.adoc[Fine-tuning Annotation-based Autowiring with Qualifiers].
923+
The `@Qualifier` annotation is discussed in
924+
xref:core/beans/annotation-config/autowired-qualifiers.adoc[Fine-tuning Annotation-based Autowiring with Qualifiers].
924925
The examples in that section demonstrate the use of the `@Qualifier` annotation and
925926
custom qualifier annotations to provide fine-grained control when you resolve autowire
926927
candidates. Because those examples were based on XML bean definitions, the qualifier

framework-docs/modules/ROOT/pages/core/beans/dependencies/factory-autowire.adoc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ instance's values consist of all bean instances that match the expected type, an
6060
`Map` instance's keys contain the corresponding bean names.
6161

6262

63+
6364
[[beans-autowired-exceptions]]
6465
== Limitations and Disadvantages of Autowiring
6566

@@ -101,10 +102,10 @@ In the latter scenario, you have several options:
101102
== Excluding a Bean from Autowiring
102103

103104
On a per-bean basis, you can exclude a bean from autowiring. In Spring's XML format, set
104-
the `autowire-candidate` attribute of the `<bean/>` element to `false`. The container
105-
makes that specific bean definition unavailable to the autowiring infrastructure
106-
(including annotation style configurations such as xref:core/beans/annotation-config/autowired.adoc[`@Autowired`]
107-
).
105+
the `autowire-candidate` attribute of the `<bean/>` element to `false`; with the `@Bean`
106+
annotation, the attribute is named `autowireCandidate`. The container makes that specific
107+
bean definition unavailable to the autowiring infrastructure, including annotation-based
108+
injection points such as xref:core/beans/annotation-config/autowired.adoc[`@Autowired`].
108109

109110
NOTE: The `autowire-candidate` attribute is designed to only affect type-based autowiring.
110111
It does not affect explicit references by name, which get resolved even if the
@@ -119,8 +120,8 @@ provide multiple patterns, define them in a comma-separated list. An explicit va
119120
`true` or `false` for a bean definition's `autowire-candidate` attribute always takes
120121
precedence. For such beans, the pattern matching rules do not apply.
121122

122-
These techniques are useful for beans that you never want to be injected into other
123-
beans by autowiring. It does not mean that an excluded bean cannot itself be configured by
123+
These techniques are useful for beans that you never want to be injected into other beans
124+
by autowiring. It does not mean that an excluded bean cannot itself be configured by
124125
using autowiring. Rather, the bean itself is not a candidate for autowiring other beans.
125126

126127

framework-docs/modules/ROOT/pages/core/beans/dependencies/factory-dependson.adoc

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
If a bean is a dependency of another bean, that usually means that one bean is set as a
55
property of another. Typically you accomplish this with the
66
xref:core/beans/dependencies/factory-properties-detailed.adoc#beans-ref-element[`<ref/>` element>]
7-
in XML-based configuration metadata. However, sometimes dependencies between beans are
8-
less direct. An example is when a static initializer in a class needs to be triggered,
9-
such as for database driver registration. The `depends-on` attribute can explicitly force
10-
one or more beans to be initialized before the bean using this element is initialized.
11-
The following example uses the `depends-on` attribute to express a dependency on a single
12-
bean:
7+
in XML-based metadata or through xref:core/beans/dependencies/factory-autowire.adoc[autowiring].
8+
9+
However, sometimes dependencies between beans are less direct. An example is when a static
10+
initializer in a class needs to be triggered, such as for database driver registration.
11+
The `depends-on` attribute or `@DependsOn` annotation can explicitly force one or more beans
12+
to be initialized before the bean using this element is initialized. The following example
13+
uses the `depends-on` attribute to express a dependency on a single bean:
1314

1415
[source,xml,indent=0,subs="verbatim,quotes"]
1516
----
@@ -32,10 +33,10 @@ delimiters):
3233
----
3334

3435
NOTE: The `depends-on` attribute can specify both an initialization-time dependency and,
35-
in the case of xref:core/beans/factory-scopes.adoc#beans-factory-scopes-singleton[singleton] beans only, a corresponding
36-
destruction-time dependency. Dependent beans that define a `depends-on` relationship
37-
with a given bean are destroyed first, prior to the given bean itself being destroyed.
38-
Thus, `depends-on` can also control shutdown order.
36+
in the case of xref:core/beans/factory-scopes.adoc#beans-factory-scopes-singleton[singleton]
37+
beans only, a corresponding destruction-time dependency. Dependent beans that define a
38+
`depends-on` relationship with a given bean are destroyed first, prior to the given bean
39+
itself being destroyed. Thus, `depends-on` can also control shutdown order.
3940

4041

4142

0 commit comments

Comments
 (0)