1
+ [[core.appendix]]
1
2
= Appendix
2
3
3
4
4
5
5
6
6
- [[xsd-schemas]]
7
+ [[core.appendix. xsd-schemas]]
7
8
== XML Schemas
8
9
9
10
This part of the appendix lists XML schemas related to the core container.
10
11
11
12
12
13
13
- [[xsd-schemas-util]]
14
+ [[core.appendix. xsd-schemas-util]]
14
15
=== The `util` Schema
15
16
16
17
As the name implies, the `util` tags deal with common, utility configuration
@@ -35,7 +36,7 @@ correct schema so that the tags in the `util` namespace are available to you):
35
36
----
36
37
37
38
38
- [[xsd-schemas-util-constant]]
39
+ [[core.appendix. xsd-schemas-util-constant]]
39
40
==== Using `<util:constant/>`
40
41
41
42
Consider the following bean definition:
@@ -68,7 +69,7 @@ developer's intent ("`inject this constant value`"), and it reads better:
68
69
</bean>
69
70
----
70
71
71
- [[xsd-schemas-util-frfb]]
72
+ [[core.appendix. xsd-schemas-util-frfb]]
72
73
===== Setting a Bean Property or Constructor Argument from a Field Value
73
74
74
75
{api-spring-framework}/beans/factory/config/FieldRetrievingFactoryBean.html[`FieldRetrievingFactoryBean`]
@@ -180,7 +181,7 @@ Now consider the following setter of type `PersistenceContextType` and the corre
180
181
----
181
182
182
183
183
- [[xsd-schemas-util-property-path]]
184
+ [[core.appendix. xsd-schemas-util-property-path]]
184
185
==== Using `<util:property-path/>`
185
186
186
187
Consider the following example:
@@ -227,7 +228,7 @@ The value of the `path` attribute of the `<property-path/>` element follows the
227
228
`beanName.beanProperty`. In this case, it picks up the `age` property of the bean named
228
229
`testBean`. The value of that `age` property is `10`.
229
230
230
- [[xsd-schemas-util-property-path-dependency]]
231
+ [[core.appendix. xsd-schemas-util-property-path-dependency]]
231
232
===== Using `<util:property-path/>` to Set a Bean Property or Constructor Argument
232
233
233
234
`PropertyPathFactoryBean` is a `FactoryBean` that evaluates a property path on a given
@@ -302,7 +303,7 @@ for most use cases, but it can sometimes be useful. See the javadoc for more inf
302
303
this feature.
303
304
304
305
305
- [[xsd-schemas-util-properties]]
306
+ [[core.appendix. xsd-schemas-util-properties]]
306
307
==== Using `<util:properties/>`
307
308
308
309
Consider the following example:
@@ -328,7 +329,7 @@ The following example uses a `util:properties` element to make a more concise re
328
329
----
329
330
330
331
331
- [[xsd-schemas-util-list]]
332
+ [[core.appendix. xsd-schemas-util-list]]
332
333
==== Using `<util:list/>`
333
334
334
335
Consider the following example:
@@ -383,7 +384,7 @@ following configuration:
383
384
If no `list-class` attribute is supplied, the container chooses a `List` implementation.
384
385
385
386
386
- [[xsd-schemas-util-map]]
387
+ [[core.appendix. xsd-schemas-util-map]]
387
388
==== Using `<util:map/>`
388
389
389
390
Consider the following example:
@@ -438,7 +439,7 @@ following configuration:
438
439
If no `'map-class'` attribute is supplied, the container chooses a `Map` implementation.
439
440
440
441
441
- [[xsd-schemas-util-set]]
442
+ [[core.appendix. xsd-schemas-util-set]]
442
443
==== Using `<util:set/>`
443
444
444
445
Consider the following example:
@@ -494,7 +495,7 @@ If no `set-class` attribute is supplied, the container chooses a `Set` implement
494
495
495
496
496
497
497
- [[xsd-schemas-aop]]
498
+ [[core.appendix. xsd-schemas-aop]]
498
499
=== The `aop` Schema
499
500
500
501
The `aop` tags deal with configuring all things AOP in Spring, including Spring's
@@ -524,7 +525,7 @@ are available to you):
524
525
525
526
526
527
527
- [[xsd-schemas-context]]
528
+ [[core.appendix. xsd-schemas-context]]
528
529
=== The `context` Schema
529
530
530
531
The `context` tags deal with `ApplicationContext` configuration that relates to plumbing
@@ -549,7 +550,7 @@ available to you:
549
550
----
550
551
551
552
552
- [[xsd-schemas-context-pphc]]
553
+ [[core.appendix. xsd-schemas-context-pphc]]
553
554
==== Using `<property-placeholder/>`
554
555
555
556
This element activates the replacement of `${...}` placeholders, which are resolved against a
@@ -559,7 +560,7 @@ is a convenience mechanism that sets up a <<core.adoc#beans-factory-placeholderc
559
560
`PropertySourcesPlaceholderConfigurer` setup, you can explicitly define it as a bean yourself.
560
561
561
562
562
- [[xsd-schemas-context-ac]]
563
+ [[core.appendix. xsd-schemas-context-ac]]
563
564
==== Using `<annotation-config/>`
564
565
565
566
This element activates the Spring infrastructure to detect annotations in bean classes:
@@ -582,36 +583,36 @@ element for that purpose. Similarly, Spring's
582
583
<<integration.adoc#cache-annotation-enable, enabled>> as well.
583
584
584
585
585
- [[xsd-schemas-context-component-scan]]
586
+ [[core.appendix. xsd-schemas-context-component-scan]]
586
587
==== Using `<component-scan/>`
587
588
588
589
This element is detailed in the section on <<core.adoc#beans-annotation-config,
589
590
annotation-based container configuration>>.
590
591
591
592
592
- [[xsd-schemas-context-ltw]]
593
+ [[core.appendix. xsd-schemas-context-ltw]]
593
594
==== Using `<load-time-weaver/>`
594
595
595
596
This element is detailed in the section on <<core.adoc#aop-aj-ltw,
596
597
load-time weaving with AspectJ in the Spring Framework>>.
597
598
598
599
599
- [[xsd-schemas-context-sc]]
600
+ [[core.appendix. xsd-schemas-context-sc]]
600
601
==== Using `<spring-configured/>`
601
602
602
603
This element is detailed in the section on <<core.adoc#aop-atconfigurable,
603
604
using AspectJ to dependency inject domain objects with Spring>>.
604
605
605
606
606
- [[xsd-schemas-context-mbe]]
607
+ [[core.appendix. xsd-schemas-context-mbe]]
607
608
==== Using `<mbean-export/>`
608
609
609
610
This element is detailed in the section on <<integration.adoc#jmx-context-mbeanexport,
610
611
configuring annotation-based MBean export>>.
611
612
612
613
613
614
614
- [[xsd-schemas-beans]]
615
+ [[core.appendix. xsd-schemas-beans]]
615
616
=== The Beans Schema
616
617
617
618
Last but not least, we have the elements in the `beans` schema. These elements
@@ -623,7 +624,7 @@ in <<core.adoc#beans-factory-properties-detailed, dependencies and configuration
623
624
Note that you can add zero or more key-value pairs to `<bean/>` XML definitions.
624
625
What, if anything, is done with this extra metadata is totally up to your own custom
625
626
logic (and so is typically only of use if you write your own custom elements as described
626
- in the appendix entitled <<xml-custom>>).
627
+ in the appendix entitled <<core.appendix. xml-custom>>).
627
628
628
629
The following example shows the `<meta/>` element in the context of a surrounding `<bean/>`
629
630
(note that, without any logic to interpret it, the metadata is effectively useless
@@ -652,10 +653,10 @@ the bean definition and sets up some caching infrastructure that uses the suppli
652
653
653
654
654
655
655
- [[xml-custom]]
656
+ [[core.appendix. xml-custom]]
656
657
== XML Schema Authoring
657
658
658
- [[xsd-custom-introduction]]
659
+ [[core.appendix. xsd-custom-introduction]]
659
660
Since version 2.0, Spring has featured a mechanism for adding schema-based extensions to the
660
661
basic Spring XML format for defining and configuring beans. This section covers
661
662
how to write your own custom XML bean definition parsers and
@@ -664,16 +665,16 @@ integrate such parsers into the Spring IoC container.
664
665
To facilitate authoring configuration files that use a schema-aware XML editor,
665
666
Spring's extensible XML configuration mechanism is based on XML Schema. If you are not
666
667
familiar with Spring's current XML configuration extensions that come with the standard
667
- Spring distribution, you should first read the previous section on <<xsd-schemas>>.
668
+ Spring distribution, you should first read the previous section on <<core.appendix. xsd-schemas>>.
668
669
669
670
670
671
To create new XML configuration extensions:
671
672
672
- . <<xsd-custom-schema, Author>> an XML schema to describe your custom element(s).
673
- . <<xsd-custom-namespacehandler, Code>> a custom `NamespaceHandler` implementation.
674
- . <<xsd-custom-parser, Code>> one or more `BeanDefinitionParser` implementations
673
+ . <<core.appendix. xsd-custom-schema, Author>> an XML schema to describe your custom element(s).
674
+ . <<core.appendix. xsd-custom-namespacehandler, Code>> a custom `NamespaceHandler` implementation.
675
+ . <<core.appendix. xsd-custom-parser, Code>> one or more `BeanDefinitionParser` implementations
675
676
(this is where the real work is done).
676
- . <<xsd-custom-registration, Register>> your new artifacts with Spring.
677
+ . <<core.appendix. xsd-custom-registration, Register>> your new artifacts with Spring.
677
678
678
679
For a unified example, we create an
679
680
XML extension (a custom XML element) that lets us configure objects of the type
@@ -693,7 +694,7 @@ through the basic steps of making a custom extension.)
693
694
694
695
695
696
696
- [[xsd-custom-schema]]
697
+ [[core.appendix. xsd-custom-schema]]
697
698
=== Authoring the Schema
698
699
699
700
Creating an XML configuration extension for use with Spring's IoC container starts with
@@ -765,7 +766,7 @@ defined in the enumeration.
765
766
766
767
767
768
768
- [[xsd-custom-namespacehandler]]
769
+ [[core.appendix. xsd-custom-namespacehandler]]
769
770
=== Coding a `NamespaceHandler`
770
771
771
772
In addition to the schema, we need a `NamespaceHandler` to parse all elements of
@@ -836,7 +837,7 @@ custom element, as we can see in the next step.
836
837
837
838
838
839
839
- [[xsd-custom-parser]]
840
+ [[core.appendix. xsd-custom-parser]]
840
841
=== Using `BeanDefinitionParser`
841
842
842
843
A `BeanDefinitionParser` is used if the `NamespaceHandler` encounters an XML
@@ -926,7 +927,7 @@ is the extraction and setting of the bean definition's unique identifier.
926
927
927
928
928
929
929
- [[xsd-custom-registration]]
930
+ [[core.appendix. xsd-custom-registration]]
930
931
=== Registering the Handler and the Schema
931
932
932
933
The coding is finished. All that remains to be done is to make the Spring XML
@@ -938,7 +939,7 @@ XML parsing infrastructure automatically picks up your new extension by consumin
938
939
these special properties files, the formats of which are detailed in the next two sections.
939
940
940
941
941
- [[xsd-custom-registration-spring-handlers]]
942
+ [[core.appendix. xsd-custom-registration-spring-handlers]]
942
943
==== Writing `META-INF/spring.handlers`
943
944
944
945
The properties file called `spring.handlers` contains a mapping of XML Schema URIs to
@@ -957,7 +958,7 @@ namespace extension and needs to exactly match exactly the value of the `targetN
957
958
attribute, as specified in your custom XSD schema.
958
959
959
960
960
- [[xsd-custom-registration-spring-schemas]]
961
+ [[core.appendix. xsd-custom-registration-spring-schemas]]
961
962
==== Writing 'META-INF/spring.schemas'
962
963
963
964
The properties file called `spring.schemas` contains a mapping of XML Schema locations
@@ -981,7 +982,7 @@ the `NamespaceHandler` and `BeanDefinitionParser` classes on the classpath.
981
982
982
983
983
984
984
- [[xsd-custom-using]]
985
+ [[core.appendix. xsd-custom-using]]
985
986
=== Using a Custom Extension in Your Spring XML Configuration
986
987
987
988
Using a custom extension that you yourself have implemented is no different from using
@@ -1015,13 +1016,13 @@ in a Spring XML configuration file:
1015
1016
1016
1017
1017
1018
1018
- [[xsd-custom-meat]]
1019
+ [[core.appendix. xsd-custom-meat]]
1019
1020
=== More Detailed Examples
1020
1021
1021
1022
This section presents some more detailed examples of custom XML extensions.
1022
1023
1023
1024
1024
- [[xsd-custom-custom-nested]]
1025
+ [[core.appendix. xsd-custom-custom-nested]]
1025
1026
==== Nesting Custom Elements within Custom Elements
1026
1027
1027
1028
The example presented in this section shows how you to write the various artifacts required
@@ -1195,7 +1196,7 @@ setter property for the `components` property. The following listing shows such
1195
1196
1196
1197
This works nicely, but it exposes a lot of Spring plumbing to the end user. What we are
1197
1198
going to do is write a custom extension that hides away all of this Spring plumbing.
1198
- If we stick to <<xsd-custom-introduction, the steps described previously>>, we start off
1199
+ If we stick to <<core.appendix. xsd-custom-introduction, the steps described previously>>, we start off
1199
1200
by creating the XSD schema to define the structure of our custom tag, as the following
1200
1201
listing shows:
1201
1202
@@ -1222,7 +1223,7 @@ listing shows:
1222
1223
</xsd:schema>
1223
1224
----
1224
1225
1225
- Again following <<xsd-custom-introduction, the process described earlier>>,
1226
+ Again following <<core.appendix. xsd-custom-introduction, the process described earlier>>,
1226
1227
we then create a custom `NamespaceHandler`:
1227
1228
1228
1229
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
@@ -1373,7 +1374,7 @@ http\://www.foo.example/schema/component/component.xsd=com/foo/component.xsd
1373
1374
----
1374
1375
1375
1376
1376
- [[xsd-custom-custom-just-attributes]]
1377
+ [[core.appendix. xsd-custom-custom-just-attributes]]
1377
1378
==== Custom Attributes on "`Normal`" Elements
1378
1379
1379
1380
Writing your own custom parser and the associated artifacts is not hard. However,
@@ -1610,7 +1611,7 @@ http\://www.foo.example/schema/jcache/jcache.xsd=com/foo/jcache.xsd
1610
1611
----
1611
1612
1612
1613
1613
- [[application-startup-steps]]
1614
+ [[core.appendix. application-startup-steps]]
1614
1615
== Application Startup Steps
1615
1616
1616
1617
This part of the appendix lists the existing `StartupSteps` that the core container is instrumented with.
0 commit comments