BeanDefinitionDocumentReader interface.
Typically applied to a
org.
or a org..
This class loads a DOM document and applies the BeanDefinitionDocumentReader to it.
The document reader will register each bean definition with the given bean factory,
talking to the latter's implementation of the
org. interface.
setDocumentReaderClass, BeanDefinitionDocumentReader, DefaultBeanDefinitionDocumentReader, BeanDefinitionRegistry, org.springframework.beans.factory.support.DefaultListableBeanFactory , org.springframework.context.support.GenericApplicationContext
| Modifier and Type | Field and Description |
|---|---|
| private static final Map | constants
Map of constant names to constant values for the validation constants defined in this class. |
| private DocumentLoader | |
| private Class | |
| private EntityResolver | |
| private ErrorHandler | |
| private ReaderEventListener | |
| private boolean | |
| private NamespaceHandlerResolver | |
| private ProblemReporter | |
| private final ThreadLocal | |
| private SourceExtractor | |
| public static final int | VALIDATION_AUTO
Indicates that the validation mode should be detected automatically. |
| public static final int | VALIDATION_DTD
Indicates that DTD validation should be used. |
| public static final int | VALIDATION_NONE
Indicates that the validation should be disabled. |
| public static final int | VALIDATION_XSD
Indicates that XSD validation should be used. |
| private int | |
| private final XmlValidationModeDetector |
| Access | Constructor and Description |
|---|---|
| public | XmlBeanDefinitionReader(BeanDefinitionRegistry
the BeanFactory to load bean definitions into,
in the form of a BeanDefinitionRegistry registry)Create new XmlBeanDefinitionReader for the given bean factory. |
| Modifier and Type | Method and Description |
|---|---|
| protected BeanDefinitionDocumentReader | createBeanDefinitionDocumentReader()
Create the |
| protected NamespaceHandlerResolver | createDefaultNamespaceHandlerResolver()
Create the default implementation of |
| public XmlReaderContext | createReaderContext(Resource resource)
Create the |
| protected int | detectValidationMode(Resource resource)
Detect which kind of validation to perform on the XML file identified
by the supplied |
| protected int | Returns: the number of bean definitions foundthe SAX InputSource to read from inputSource, Resource the resource descriptor for the XML file resource)Actually load bean definitions from the specified XML file. |
| protected Document | Returns: the DOM Documentthe SAX InputSource to read from inputSource, Resource the resource descriptor for the XML file resource)Actually load the specified document using the configured DocumentLoader. |
| protected EntityResolver | |
| public NamespaceHandlerResolver | |
| public int | |
| protected int | getValidationModeForResource(Resource resource)
Determine the validation mode for the specified |
| public boolean | |
| public int | Returns: the number of bean definitions foundthe resource descriptor for the XML file resource)Implements org. |
| public int | Returns: the number of bean definitions foundthe resource descriptor for the XML file,
allowing to specify an encoding to use for parsing the file encodedResource)Load bean definitions from the specified XML file. |
| public int | Returns: the number of bean definitions foundthe SAX InputSource to read from inputSource)Load bean definitions from the specified XML file. |
| public int | Returns: the number of bean definitions foundthe SAX InputSource to read from inputSource, String a description of the resource
(can be resourceDescription)null or empty)Load bean definitions from the specified XML file. |
| public int | Returns: the number of bean definitions foundthe DOM document doc, Resource the resource descriptor (for context information) resource)Register the bean definitions contained in the given DOM document. |
| public void | |
| public void | setDocumentReaderClass(Class<? extends BeanDefinitionDocumentReader>
the desired BeanDefinitionDocumentReader implementation class documentReaderClass)Specify the |
| public void | |
| public void | setErrorHandler(ErrorHandler errorHandler)
Set an implementation of the |
| public void | |
| public void | |
| public void | setNamespaceHandlerResolver(NamespaceHandlerResolver namespaceHandlerResolver)
Specify the |
| public void | setProblemReporter(ProblemReporter problemReporter)
Specify which |
| public void | |
| public void | |
| public void | |
| public void |
| constants | back to summary |
|---|---|
| private static final Map<String, Integer> constants Map of constant names to constant values for the validation constants defined in this class. | |
| documentLoader | back to summary |
|---|---|
| private DocumentLoader documentLoader | |
| documentReaderClass | back to summary |
|---|---|
| private Class<? extends BeanDefinitionDocumentReader> documentReaderClass | |
| entityResolver | back to summary |
|---|---|
| private EntityResolver entityResolver
| |
| errorHandler | back to summary |
|---|---|
| private ErrorHandler errorHandler | |
| eventListener | back to summary |
|---|---|
| private ReaderEventListener eventListener | |
| namespaceAware | back to summary |
|---|---|
| private boolean namespaceAware | |
| namespaceHandlerResolver | back to summary |
|---|---|
| private NamespaceHandlerResolver namespaceHandlerResolver
| |
| problemReporter | back to summary |
|---|---|
| private ProblemReporter problemReporter | |
| resourcesCurrentlyBeingLoaded | back to summary |
|---|---|
| private final ThreadLocal<Set<EncodedResource>> resourcesCurrentlyBeingLoaded | |
| sourceExtractor | back to summary |
|---|---|
| private SourceExtractor sourceExtractor | |
| VALIDATION_AUTO | back to summary |
|---|---|
| public static final int VALIDATION_AUTO Indicates that the validation mode should be detected automatically. | |
| VALIDATION_DTD | back to summary |
|---|---|
| public static final int VALIDATION_DTD Indicates that DTD validation should be used. | |
| VALIDATION_NONE | back to summary |
|---|---|
| public static final int VALIDATION_NONE Indicates that the validation should be disabled. | |
| VALIDATION_XSD | back to summary |
|---|---|
| public static final int VALIDATION_XSD Indicates that XSD validation should be used. | |
| validationMode | back to summary |
|---|---|
| private int validationMode | |
| validationModeDetector | back to summary |
|---|---|
| private final XmlValidationModeDetector validationModeDetector | |
| XmlBeanDefinitionReader | back to summary |
|---|---|
| public XmlBeanDefinitionReader(BeanDefinitionRegistry registry) Create new XmlBeanDefinitionReader for the given bean factory.
| |
| createBeanDefinitionDocumentReader | back to summary |
|---|---|
| protected BeanDefinitionDocumentReader createBeanDefinitionDocumentReader() Create the The default implementation instantiates the specified "documentReaderClass".
| |
| createDefaultNamespaceHandlerResolver | back to summary |
|---|---|
| protected NamespaceHandlerResolver createDefaultNamespaceHandlerResolver() Create the default implementation of The default implementation returns an instance of | |
| createReaderContext | back to summary |
|---|---|
| public XmlReaderContext createReaderContext(Resource resource) Create the | |
| detectValidationMode | back to summary |
|---|---|
| protected int detectValidationMode(Resource resource) Detect which kind of validation to perform on the XML file identified
by the supplied Override this method if you would like to customize resolution
of the | |
| doLoadBeanDefinitions | back to summary |
|---|---|
| protected int doLoadBeanDefinitions(InputSource inputSource, Resource resource) throws BeanDefinitionStoreException Actually load bean definitions from the specified XML file.
| |
| doLoadDocument | back to summary |
|---|---|
| protected Document doLoadDocument(InputSource inputSource, Resource resource) throws Exception Actually load the specified document using the configured DocumentLoader.
| |
| getEntityResolver | back to summary |
|---|---|
| protected EntityResolver getEntityResolver() Return the EntityResolver to use, building a default resolver if none specified. | |
| getNamespaceHandlerResolver | back to summary |
|---|---|
| public NamespaceHandlerResolver getNamespaceHandlerResolver() Lazily create a default NamespaceHandlerResolver, if not set before. | |
| getValidationMode | back to summary |
|---|---|
| public int getValidationMode() Return the validation mode to use. | |
| getValidationModeForResource | back to summary |
|---|---|
| protected int getValidationModeForResource(Resource resource) Determine the validation mode for the specified Override this method if you would like full control over the validation
mode, even when something other than
| |
| isNamespaceAware | back to summary |
|---|---|
| public boolean isNamespaceAware() Return whether the XML parser should be XML namespace aware. | |
| loadBeanDefinitions | back to summary |
|---|---|
| public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException Implements org. Load bean definitions from the specified XML file.
| |
| loadBeanDefinitions | back to summary |
|---|---|
| public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException Load bean definitions from the specified XML file.
| |
| loadBeanDefinitions | back to summary |
|---|---|
| public int loadBeanDefinitions(InputSource inputSource) throws BeanDefinitionStoreException Load bean definitions from the specified XML file.
| |
| loadBeanDefinitions | back to summary |
|---|---|
| public int loadBeanDefinitions(InputSource inputSource, String resourceDescription) throws BeanDefinitionStoreException Load bean definitions from the specified XML file.
| |
| registerBeanDefinitions | back to summary |
|---|---|
| public int registerBeanDefinitions(Document doc, Resource resource) throws BeanDefinitionStoreException Register the bean definitions contained in the given DOM document.
Called by Creates a new instance of the parser class and invokes
| |
| setDocumentLoader | back to summary |
|---|---|
| public void setDocumentLoader(DocumentLoader documentLoader) Specify the The default implementation is | |
| setDocumentReaderClass | back to summary |
|---|---|
| public void setDocumentReaderClass(Class<? extends BeanDefinitionDocumentReader> documentReaderClass) Specify the The default is
| |
| setEntityResolver | back to summary |
|---|---|
| public void setEntityResolver(EntityResolver entityResolver) Set a SAX entity resolver to be used for parsing. By default, | |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(ErrorHandler errorHandler) Set an implementation of the 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.
| |
| setEventListener | back to summary |
|---|---|
| public void setEventListener(ReaderEventListener eventListener) Specify which The default implementation is EmptyReaderEventListener which discards every event notification. External tools can provide an alternative implementation to monitor the components being registered in the BeanFactory. | |
| setNamespaceAware | back to summary |
|---|---|
| public void setNamespaceAware(boolean namespaceAware) Set whether the XML parser should be XML namespace aware. Default is "false". This is typically not needed when schema validation is active. However, without validation, this has to be switched to "true" in order to properly process schema namespaces. | |
| setNamespaceHandlerResolver | back to summary |
|---|---|
| public void setNamespaceHandlerResolver(NamespaceHandlerResolver namespaceHandlerResolver) Specify the If none is specified, a default instance will be created through
| |
| setProblemReporter | back to summary |
|---|---|
| public void setProblemReporter(ProblemReporter problemReporter) Specify which The default implementation is | |
| setSourceExtractor | back to summary |
|---|---|
| public void setSourceExtractor(SourceExtractor sourceExtractor) Specify the The default implementation is | |
| setValidating | back to summary |
|---|---|
| public void setValidating(boolean validating) Set whether to use XML validation. Default is This method switches namespace awareness on if validation is turned off, in order to still process schema namespaces properly in such a scenario.
| |
| setValidationMode | back to summary |
|---|---|
| public void setValidationMode(int validationMode) Set the validation mode to use. Defaults to Note that this only activates or deactivates validation itself.
If you are switching validation off for schema files, you might need to
activate schema namespace support explicitly: see | |
| setValidationModeName | back to summary |
|---|---|
| public void setValidationModeName(String validationModeName) Set the validation mode to use by name. Defaults to
| |