|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.factory.support.AbstractBeanDefinitionReader org.springframework.beans.factory.xml.XmlBeanDefinitionReader
public class XmlBeanDefinitionReader
Bean definition reader for XML bean definitions. Delegates the actual XML parsing to an implementation of the XmlBeanDefinitionParser interface. Typically applied to a DefaultListableBeanFactory.
This class loads a DOM document and applies the bean definition parser to it. The parser will register each bean definition with the given bean factory, relying on the latter's implementation of the BeanDefinitionRegistry interface.
setParserClass(java.lang.Class)
,
XmlBeanDefinitionParser
,
DefaultXmlBeanDefinitionParser
,
BeanDefinitionRegistry
,
DefaultListableBeanFactory
Field Summary |
---|
Fields inherited from class org.springframework.beans.factory.support.AbstractBeanDefinitionReader |
---|
logger |
Constructor Summary | |
---|---|
XmlBeanDefinitionReader(BeanDefinitionRegistry beanFactory)
Create new XmlBeanDefinitionReader for the given bean factory. |
Method Summary | |
---|---|
protected DocumentBuilder |
createDocumentBuilder(DocumentBuilderFactory factory)
Create a JAXP DocumentBuilder that this bean definition reader will use for parsing XML documents. |
protected DocumentBuilderFactory |
createDocumentBuilderFactory()
Create a JAXP DocumentBuilderFactory that this bean definition reader will use for parsing XML documents. |
protected int |
doLoadBeanDefinitions(InputSource inputSource,
Resource resource)
Actually load bean definitions from the specified XML file. |
int |
loadBeanDefinitions(EncodedResource encodedResource)
Load bean definitions from the specified XML file. |
int |
loadBeanDefinitions(InputSource inputSource)
Load bean definitions from the specified XML file. |
int |
loadBeanDefinitions(InputSource inputSource,
String resourceDescription)
Load bean definitions from the specified XML file. |
int |
loadBeanDefinitions(Resource resource)
Load bean definitions from the specified XML file. |
int |
registerBeanDefinitions(Document doc,
Resource resource)
Register the bean definitions contained in the given DOM document. |
void |
setEntityResolver(EntityResolver entityResolver)
Set a SAX entity resolver to be used for parsing. |
void |
setErrorHandler(ErrorHandler errorHandler)
Set an implementation of the org.xml.sax.ErrorHandler
interface for custom handling of XML parsing errors and warnings. |
void |
setNamespaceAware(boolean namespaceAware)
Set whether or not the XML parser should be XML namespace aware. |
void |
setParserClass(Class parserClass)
Set the XmlBeanDefinitionParser implementation to use, responsible for the actual parsing of XML bean definitions. |
void |
setValidating(boolean validating)
Set if the XML parser should validate the document and thus enforce a DTD. |
Methods inherited from class org.springframework.beans.factory.support.AbstractBeanDefinitionReader |
---|
getBeanClassLoader, getBeanFactory, getResourceLoader, loadBeanDefinitions, loadBeanDefinitions, loadBeanDefinitions, setBeanClassLoader, setResourceLoader |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlBeanDefinitionReader(BeanDefinitionRegistry beanFactory)
Method Detail |
---|
public void setValidating(boolean validating)
public void setNamespaceAware(boolean namespaceAware)
public void setErrorHandler(ErrorHandler errorHandler)
org.xml.sax.ErrorHandler
interface for custom handling of XML parsing errors and warnings.
If not set, a default SimpleSaxErrorHandler is used that simply logs warnings using the logger instance of the view class, and rethrows errors to discontinue the XML transformation.
SimpleSaxErrorHandler
public void setEntityResolver(EntityResolver entityResolver)
BeansDtdResolver
public void setParserClass(Class parserClass)
public int loadBeanDefinitions(Resource resource) throws BeansException
resource
- the resource descriptor for the XML file
BeanDefinitionStoreException
- in case of loading or parsing errors
BeansException
public int loadBeanDefinitions(EncodedResource encodedResource) throws BeansException
encodedResource
- the resource descriptor for the XML file,
allowing to specify an encoding to use for parsing the file
BeanDefinitionStoreException
- in case of loading or parsing errors
BeansException
public int loadBeanDefinitions(InputSource inputSource) throws BeansException
inputSource
- the SAX InputSource to read from
BeanDefinitionStoreException
- in case of loading or parsing errors
BeansException
public int loadBeanDefinitions(InputSource inputSource, String resourceDescription) throws BeansException
inputSource
- the SAX InputSource to read fromresourceDescription
- a description of the resource
(can be null
or empty)
BeanDefinitionStoreException
- in case of loading or parsing errors
BeansException
protected int doLoadBeanDefinitions(InputSource inputSource, Resource resource) throws BeansException
inputSource
- the SAX InputSource to read fromresource
- the resource descriptor for the XML file
BeanDefinitionStoreException
- in case of loading or parsing errors
BeansException
protected DocumentBuilderFactory createDocumentBuilderFactory() throws ParserConfigurationException
ParserConfigurationException
- if thrown by JAXP methodsprotected DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory) throws ParserConfigurationException
factory
- the JAXP DocumentBuilderFactory that the
DocumentBuilder should be created with
ParserConfigurationException
- if thrown by JAXP methodspublic int registerBeanDefinitions(Document doc, Resource resource) throws BeansException
loadBeanDefinitions
.
Creates a new instance of the parser class and invokes
registerBeanDefinitions
on it.
doc
- the DOM documentresource
- the resource descriptor (for context information)
BeansException
- in case of parser instantiation failure
BeanDefinitionStoreException
- in case of parsing errorsloadBeanDefinitions(org.springframework.core.io.Resource)
,
setParserClass(java.lang.Class)
,
XmlBeanDefinitionParser.registerBeanDefinitions(org.springframework.beans.factory.support.BeanDefinitionReader, org.w3c.dom.Document, org.springframework.core.io.Resource)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |