Since version 2.0, Spring has featured a mechanism for schema-based extensions to the basic Spring XML format for defining and configuring beans. This section is devoted to detailing how you would go about writing your own custom XML bean definition parsers and integrating such parsers into the Spring IoC container.
To facilitate the authoring of configuration files using a schema-aware XML editor, Spring's extensible XML configuration mechanism is based on XML Schema. If you are not familiar with Spring's current XML configuration extensions that come with the standard Spring distribution, please first read the appendix entitled 附录 A, XML Schema-based configuration.
Creating new XML configuration extensions can be done by following a (relatively)
simple process of authoring an XML schema, coding a
NamespaceHandler implementation, coding one or more
BeanDefinitionParser instances and registering the
NamespaceHandler and the schema in a dedicated
properties file. What follows is a description of each of these steps. In the example,
we'll create an XML extension (a custom XML element) that allows us to configure
objects of type
SimpleDateFormat directly in a Spring IoC