@@ -565,9 +565,9 @@ itself.
565
565
Specifying all aliases where the bean is actually defined is not always adequate,
566
566
however. It is sometimes desirable to introduce an alias for a bean that is defined
567
567
elsewhere. This is commonly the case in large systems where configuration is split
568
- amongst each subsystem, with each subsystem having its own set of object definitions. In
569
- XML-based configuration metadata, you can use the `<alias/>` element to accomplish this.
570
- The following example shows how to do so:
568
+ amongst each subsystem, with each subsystem having its own set of object definitions.
569
+ In XML-based configuration metadata, you can use the `<alias/>` element to accomplish
570
+ this. The following example shows how to do so:
571
571
572
572
====
573
573
[source,xml,indent=0]
@@ -580,19 +580,19 @@ The following example shows how to do so:
580
580
In this case, a bean (in the same container) named `fromName` may also,
581
581
after the use of this alias definition, be referred to as `toName`.
582
582
583
- For example, the configuration metadata for subsystem A may refer to a DataSource by
584
- the name of `subsystemA-dataSource`. The configuration metadata for subsystem B may refer to
583
+ For example, the configuration metadata for subsystem A may refer to a DataSource by the
584
+ name of `subsystemA-dataSource`. The configuration metadata for subsystem B may refer to
585
585
a DataSource by the name of `subsystemB-dataSource`. When composing the main application
586
586
that uses both these subsystems, the main application refers to the DataSource by the
587
- name of `myApp-dataSource`. To have all three names refer to the same object, you can add
588
- the following alias definitions to the configuration metadata:
587
+ name of `myApp-dataSource`. To have all three names refer to the same object, you can
588
+ add the following alias definitions to the configuration metadata:
589
589
590
590
====
591
591
[source,xml,indent=0]
592
592
[subs="verbatim,quotes"]
593
593
----
594
- <alias name="subsystemA -dataSource" alias="subsystemB -dataSource"/>
595
- <alias name="subsystemA -dataSource" alias="myApp -dataSource" />
594
+ <alias name="myApp -dataSource" alias="subsystemA -dataSource"/>
595
+ <alias name="myApp -dataSource" alias="subsystemB -dataSource"/>
596
596
----
597
597
====
598
598
@@ -7231,7 +7231,7 @@ a number of aliases for a bean:
7231
7231
@Configuration
7232
7232
public class AppConfig {
7233
7233
7234
- @Bean(name = { "dataSource", "subsystemA-dataSource", "subsystemB-dataSource" })
7234
+ @Bean({ "dataSource", "subsystemA-dataSource", "subsystemB-dataSource"})
7235
7235
public DataSource dataSource() {
7236
7236
// instantiate, configure and return DataSource bean...
7237
7237
}
0 commit comments