Skip to content

Commit 9b28e58

Browse files
committed
Merge branch '6.1.x'
2 parents 7aa25e0 + acf82e7 commit 9b28e58

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ Kotlin::
159159
----
160160
======
161161

162-
.[[beans-factory-ctor-arguments-type]]Constructor argument type matching
163-
--
162+
[discrete]
163+
[[beans-factory-ctor-arguments-type]]
164+
==== Constructor argument type matching
165+
164166
In the preceding scenario, the container can use type matching with simple types if
165-
you explicitly specify the type of the constructor argument by using the `type` attribute,
167+
you explicitly specify the type of the constructor argument via the `type` attribute,
166168
as the following example shows:
167169

168170
[source,xml,indent=0,subs="verbatim,quotes"]
@@ -172,10 +174,11 @@ as the following example shows:
172174
<constructor-arg type="java.lang.String" value="42"/>
173175
</bean>
174176
----
175-
--
176177

177-
.[[beans-factory-ctor-arguments-index]]Constructor argument index
178-
--
178+
[discrete]
179+
[[beans-factory-ctor-arguments-index]]
180+
==== Constructor argument index
181+
179182
You can use the `index` attribute to specify explicitly the index of constructor arguments,
180183
as the following example shows:
181184

@@ -191,10 +194,11 @@ In addition to resolving the ambiguity of multiple simple values, specifying an
191194
resolves ambiguity where a constructor has two arguments of the same type.
192195

193196
NOTE: The index is 0-based.
194-
--
195197

196-
.[[beans-factory-ctor-arguments-name]]Constructor argument name
197-
--
198+
[discrete]
199+
[[beans-factory-ctor-arguments-name]]
200+
==== Constructor argument name
201+
198202
You can also use the constructor parameter name for value disambiguation, as the following
199203
example shows:
200204

@@ -244,7 +248,6 @@ Kotlin::
244248
constructor(val years: Int, val ultimateAnswer: String)
245249
----
246250
======
247-
--
248251

249252

250253
[[beans-setter-injection]]

framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ the configuration model, in that references to other beans must be valid Java sy
116116
Fortunately, solving this problem is simple. As
117117
xref:core/beans/java/bean-annotation.adoc#beans-java-dependencies[we already discussed],
118118
a `@Bean` method can have an arbitrary number of parameters that describe the bean
119-
dependencies. Consider the following more real-world scenario with several `@Configuration`
119+
dependencies. Consider the following more realistic scenario with several `@Configuration`
120120
classes, each depending on beans declared in the others:
121121

122122
[tabs]
@@ -331,8 +331,10 @@ TIP: Constructor injection in `@Configuration` classes is only supported as of S
331331
Framework 4.3. Note also that there is no need to specify `@Autowired` if the target
332332
bean defines only one constructor.
333333

334-
.[[beans-java-injecting-imported-beans-fq]]Fully-qualifying imported beans for ease of navigation
335-
--
334+
[discrete]
335+
[[beans-java-injecting-imported-beans-fq]]
336+
==== Fully-qualifying imported beans for ease of navigation
337+
336338
In the preceding scenario, using `@Autowired` works well and provides the desired
337339
modularity, but determining exactly where the autowired bean definitions are declared is
338340
still somewhat ambiguous. For example, as a developer looking at `ServiceConfig`, how do
@@ -501,7 +503,6 @@ Now `ServiceConfig` is loosely coupled with respect to the concrete
501503
get a type hierarchy of `RepositoryConfig` implementations. In this
502504
way, navigating `@Configuration` classes and their dependencies becomes no different
503505
than the usual process of navigating interface-based code.
504-
--
505506

506507

507508
[[beans-java-startup]]
@@ -631,8 +632,10 @@ that uses Spring XML, it is easier to create `@Configuration` classes on an
631632
as-needed basis and include them from the existing XML files. Later in this section, we cover the
632633
options for using `@Configuration` classes in this kind of "`XML-centric`" situation.
633634

634-
.[[beans-java-combining-xml-centric-declare-as-bean]]Declaring `@Configuration` classes as plain Spring `<bean/>` elements
635-
--
635+
[discrete]
636+
[[beans-java-combining-xml-centric-declare-as-bean]]
637+
==== Declaring `@Configuration` classes as plain Spring `<bean/>` elements
638+
636639
Remember that `@Configuration` classes are ultimately bean definitions in the
637640
container. In this series examples, we create a `@Configuration` class named `AppConfig` and
638641
include it within `system-test-config.xml` as a `<bean/>` definition. Because
@@ -740,16 +743,16 @@ Kotlin::
740743
----
741744
======
742745

743-
744746
NOTE: In `system-test-config.xml` file, the `AppConfig` `<bean/>` does not declare an `id`
745747
element. While it would be acceptable to do so, it is unnecessary, given that no other bean
746748
ever refers to it, and it is unlikely to be explicitly fetched from the container by name.
747749
Similarly, the `DataSource` bean is only ever autowired by type, so an explicit bean `id`
748750
is not strictly required.
749-
--
750751

751-
.[[beans-java-combining-xml-centric-component-scan]] Using <context:component-scan/> to pick up `@Configuration` classes
752-
--
752+
[discrete]
753+
[[beans-java-combining-xml-centric-component-scan]]
754+
==== Using <context:component-scan/> to pick up `@Configuration` classes
755+
753756
Because `@Configuration` is meta-annotated with `@Component`, `@Configuration`-annotated
754757
classes are automatically candidates for component scanning. Using the same scenario as
755758
described in the previous example, we can redefine `system-test-config.xml` to take advantage of component-scanning.
@@ -773,7 +776,6 @@ The following example shows the modified `system-test-config.xml` file:
773776
</bean>
774777
</beans>
775778
----
776-
--
777779

778780
[[beans-java-combining-java-centric]]
779781
=== `@Configuration` Class-centric Use of XML with `@ImportResource`

0 commit comments

Comments
 (0)