java.lang.Object | |
↳ | org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader |
Default implementation of the BeanDefinitionDocumentReader
interface.
Reads bean definitions according to the "spring-beans" DTD and XSD format
(Spring's default XML bean definition format).
The structure, elements and attribute names of the required XML document
are hard-coded in this class. (Of course a transform could be run if necessary
to produce this format). <beans>
doesn't need to be the root
element of the XML document: This class will parse all bean definition elements
in the XML file, not regarding the actual root element.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ALIAS_ATTRIBUTE | ||||||||||
String | ALIAS_ELEMENT | ||||||||||
String | BEAN_ELEMENT | ||||||||||
String | IMPORT_ELEMENT | ||||||||||
String | NAME_ATTRIBUTE | ||||||||||
String | NESTED_BEANS_ELEMENT | ||||||||||
String | PROFILE_ATTRIBUTE | ||||||||||
String | RESOURCE_ATTRIBUTE |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
logger |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Read bean definitions from the given DOM document,
and register them with the given bean factory.
This implementation parses bean definitions according to the "spring-beans" XSD (or DTD, historically). | |||||||||||
Set the Environment to use when reading bean definitions.
Default value is |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Register each bean definition within the given root
<beans/> element. | |||||||||||
Invoke the
SourceExtractor to pull the
source metadata from the supplied Element . | |||||||||||
Return the descriptor for the XML resource that this parser works on.
| |||||||||||
Parse an "import" element and load the bean definitions
from the given resource into the bean factory.
| |||||||||||
Parse the elements at the root level in the document:
"import", "alias", "bean".
| |||||||||||
Allow the XML to be extensible by processing any custom element types last,
after we finished processing the bean definitions.
| |||||||||||
Allow the XML to be extensible by processing any custom element types first,
before we start to process the bean definitions.
| |||||||||||
Process the given alias element, registering the alias with the registry.
| |||||||||||
Process the given bean element, parsing the bean definition
and registering it with the registry.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.xml.BeanDefinitionDocumentReader
|
Read bean definitions from the given DOM document, and register them with the given bean factory.
This implementation parses bean definitions according to the "spring-beans" XSD (or DTD, historically).
Opens a DOM Document; then initializes the default settings
specified at the <beans/>
level; then parses the contained bean definitions.
doc | the DOM document |
---|---|
readerContext | the current context of the reader. Includes the resource being parsed |
Set the Environment to use when reading bean definitions. Used for evaluating
profile information to determine whether a <beans/>
document/element should
be included or omitted.
Default value is null
; property is required for parsing any
<beans/>
element with a profile
attribute present.
Register each bean definition within the given root <beans/>
element.
IllegalStateException | if <beans profile="..." attribute is present
and Environment property has not been set |
---|
Invoke the SourceExtractor
to pull the
source metadata from the supplied Element
.
Return the descriptor for the XML resource that this parser works on.
Parse an "import" element and load the bean definitions from the given resource into the bean factory.
Parse the elements at the root level in the document: "import", "alias", "bean".
root | the DOM root element of the document |
---|
Allow the XML to be extensible by processing any custom element types last, after we finished processing the bean definitions. This method is a natural extension point for any other custom post-processing of the XML.
The default implementation is empty. Subclasses can override this method to convert custom elements into standard Spring bean definitions, for example. Implementors have access to the parser's bean definition reader and the underlying XML resource, through the corresponding accessors.
Allow the XML to be extensible by processing any custom element types first, before we start to process the bean definitions. This method is a natural extension point for any other custom pre-processing of the XML.
The default implementation is empty. Subclasses can override this method to convert custom elements into standard Spring bean definitions, for example. Implementors have access to the parser's bean definition reader and the underlying XML resource, through the corresponding accessors.
Process the given alias element, registering the alias with the registry.
Process the given bean element, parsing the bean definition and registering it with the registry.