Skip to content

Commit 0761446

Browse files
committed
Revised alias definition example in reference documentation
Issue: SPR-17536
1 parent 7b2eebe commit 0761446

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/docs/asciidoc/core/core-beans.adoc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,21 +546,21 @@ XML-based configuration metadata, you can use the `<alias/>` element to accompli
546546
<alias name="fromName" alias="toName"/>
547547
----
548548

549-
In this case, a bean in the same container which is named `fromName`, may also,
549+
In this case, a bean (in the same container) named `fromName` may also,
550550
after the use of this alias definition, be referred to as `toName`.
551551

552-
For example, the configuration metadata for subsystem A may refer to a DataSource via
553-
the name `subsystemA-dataSource`. The configuration metadata for subsystem B may refer to
554-
a DataSource via the name `subsystemB-dataSource`. When composing the main application
555-
that uses both these subsystems the main application refers to the DataSource via the
556-
name `myApp-dataSource`. To have all three names refer to the same object you add to the
557-
MyApp configuration metadata the following aliases definitions:
552+
For example, the configuration metadata for subsystem A may refer to a DataSource by the
553+
name of `subsystemA-dataSource`. The configuration metadata for subsystem B may refer to
554+
a DataSource by the name of `subsystemB-dataSource`. When composing the main application
555+
that uses both these subsystems, the main application refers to the DataSource by the
556+
name of `myApp-dataSource`. To have all three names refer to the same object, you can
557+
add the following alias definitions to the configuration metadata:
558558

559559
[source,xml,indent=0]
560560
[subs="verbatim,quotes"]
561561
----
562-
<alias name="subsystemA-dataSource" alias="subsystemB-dataSource"/>
563-
<alias name="subsystemA-dataSource" alias="myApp-dataSource" />
562+
<alias name="myApp-dataSource" alias="subsystemA-dataSource"/>
563+
<alias name="myApp-dataSource" alias="subsystemB-dataSource"/>
564564
----
565565

566566
Now each component and the main application can refer to the dataSource through a name
@@ -6808,7 +6808,7 @@ annotation accepts a String array for this purpose.
68086808
@Configuration
68096809
public class AppConfig {
68106810
6811-
@Bean(name = { "dataSource", "subsystemA-dataSource", "subsystemB-dataSource" })
6811+
@Bean({"dataSource", "subsystemA-dataSource", "subsystemB-dataSource"})
68126812
public DataSource dataSource() {
68136813
// instantiate, configure and return DataSource bean...
68146814
}

0 commit comments

Comments
 (0)