类 DefaultBeanDefinitionDocumentReader
- java.lang.Object
- org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader
- 所有已实现的接口:
BeanDefinitionDocumentReader
public class DefaultBeanDefinitionDocumentReader extends Object implements BeanDefinitionDocumentReader
Default implementation of theBeanDefinitionDocumentReader
interface that 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>
does not need to be the root element of the XML document: this class will parse all bean definition elements in the XML file, regardless of the actual root element.- 从以下版本开始:
- 18.12.2003
- 作者:
- Rod Johnson, Juergen Hoeller, Rob Harrop, Erik Wiersma
字段概要
字段 修饰符和类型 字段 说明 static String
ALIAS_ATTRIBUTE
static String
ALIAS_ELEMENT
static String
BEAN_ELEMENT
static String
IMPORT_ELEMENT
protected Log
logger
static String
NAME_ATTRIBUTE
static String
NESTED_BEANS_ELEMENT
static String
PROFILE_ATTRIBUTE
static String
RESOURCE_ATTRIBUTE
构造器概要
构造器 构造器 说明 DefaultBeanDefinitionDocumentReader()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected BeanDefinitionParserDelegate
createDelegate(XmlReaderContext readerContext, Element root, BeanDefinitionParserDelegate parentDelegate)
protected void
doRegisterBeanDefinitions(Element root)
Register each bean definition within the given root<beans/>
element.protected Object
extractSource(Element ele)
Invoke theSourceExtractor
to pull the source metadata from the suppliedElement
.protected XmlReaderContext
getReaderContext()
Return the descriptor for the XML resource that this parser works on.protected void
importBeanDefinitionResource(Element ele)
Parse an "import" element and load the bean definitions from the given resource into the bean factory.protected void
parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate)
Parse the elements at the root level in the document: "import", "alias", "bean".protected void
postProcessXml(Element root)
Allow the XML to be extensible by processing any custom element types last, after we finished processing the bean definitions.protected void
preProcessXml(Element root)
Allow the XML to be extensible by processing any custom element types first, before we start to process the bean definitions.protected void
processAliasRegistration(Element ele)
Process the given alias element, registering the alias with the registry.protected void
processBeanDefinition(Element ele, BeanDefinitionParserDelegate delegate)
Process the given bean element, parsing the bean definition and registering it with the registry.void
registerBeanDefinitions(Document doc, XmlReaderContext readerContext)
This implementation parses bean definitions according to the "spring-beans" XSD (or DTD, historically).
字段详细资料
BEAN_ELEMENT
public static final String BEAN_ELEMENT
- 另请参阅:
- 常量字段值
NESTED_BEANS_ELEMENT
public static final String NESTED_BEANS_ELEMENT
- 另请参阅:
- 常量字段值
ALIAS_ELEMENT
public static final String ALIAS_ELEMENT
- 另请参阅:
- 常量字段值
NAME_ATTRIBUTE
public static final String NAME_ATTRIBUTE
- 另请参阅:
- 常量字段值
ALIAS_ATTRIBUTE
public static final String ALIAS_ATTRIBUTE
- 另请参阅:
- 常量字段值
IMPORT_ELEMENT
public static final String IMPORT_ELEMENT
- 另请参阅:
- 常量字段值
RESOURCE_ATTRIBUTE
public static final String RESOURCE_ATTRIBUTE
- 另请参阅:
- 常量字段值
PROFILE_ATTRIBUTE
public static final String PROFILE_ATTRIBUTE
- 另请参阅:
- 常量字段值
构造器详细资料
DefaultBeanDefinitionDocumentReader
public DefaultBeanDefinitionDocumentReader()
方法详细资料
registerBeanDefinitions
public void registerBeanDefinitions(Document doc, XmlReaderContext readerContext)
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.- 指定者:
registerBeanDefinitions
在接口中BeanDefinitionDocumentReader
- 参数:
doc
- the DOM documentreaderContext
- the current context of the reader (includes the target registry and the resource being parsed)
getReaderContext
protected final XmlReaderContext getReaderContext()
Return the descriptor for the XML resource that this parser works on.
extractSource
protected Object extractSource(Element ele)
Invoke theSourceExtractor
to pull the source metadata from the suppliedElement
.
doRegisterBeanDefinitions
protected void doRegisterBeanDefinitions(Element root)
Register each bean definition within the given root<beans/>
element.
createDelegate
protected BeanDefinitionParserDelegate createDelegate(XmlReaderContext readerContext, Element root, BeanDefinitionParserDelegate parentDelegate)
parseBeanDefinitions
protected void parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate)
Parse the elements at the root level in the document: "import", "alias", "bean".- 参数:
root
- the DOM root element of the document
importBeanDefinitionResource
protected void importBeanDefinitionResource(Element ele)
Parse an "import" element and load the bean definitions from the given resource into the bean factory.
processAliasRegistration
protected void processAliasRegistration(Element ele)
Process the given alias element, registering the alias with the registry.
processBeanDefinition
protected void processBeanDefinition(Element ele, BeanDefinitionParserDelegate delegate)
Process the given bean element, parsing the bean definition and registering it with the registry.
preProcessXml
protected void preProcessXml(Element root)
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.
- 另请参阅:
getReaderContext()
postProcessXml
protected void postProcessXml(Element root)
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.
- 另请参阅:
getReaderContext()