com.interface21.beans.factory.xml
Class XmlBeanFactory
java.lang.Object
|
+--com.interface21.beans.factory.support.AbstractBeanFactory
|
+--com.interface21.beans.factory.support.ListableBeanFactoryImpl
|
+--com.interface21.beans.factory.xml.XmlBeanFactory
- All Implemented Interfaces:
- BeanFactory, ListableBeanFactory
- public class XmlBeanFactory
- extends ListableBeanFactoryImpl
Extension of ListableBeanFactoryImpl that reads bean definitions in an XML
document using DOM. The structure, element 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.
This class registers each bean definition with the ListableBeanFactoryImpl
superclass, and relies on the latter's implementation of the BeanFactory
interface. It supports singletons, prototypes and references to either of
these kinds of bean.
Pre-instantiates singletons. TODO: This could be made configurable.
- Since:
- 15 April 2001
- Version:
- $Id: XmlBeanFactory.java,v 1.2 2003/06/22 20:02:52 jhoeller Exp $
- Author:
- Rod Johnson
|
Constructor Summary |
XmlBeanFactory(org.w3c.dom.Document doc)
Creates new XmlBeanFactory from a DOM document |
XmlBeanFactory(org.w3c.dom.Document doc,
BeanFactory parentBeanFactory)
Creates new XmlBeanFactory from a DOM document |
XmlBeanFactory(java.io.InputStream is)
Create a new XmlBeanFactory with the given input stream,
which must be parsable using DOM. |
XmlBeanFactory(java.io.InputStream is,
BeanFactory parentBeanFactory)
Create a new XmlBeanFactory with the given input stream,
which must be parsable using DOM. |
XmlBeanFactory(java.lang.String filename)
Creates new XmlBeanFactory using java.io to read the XML document with the given filename |
XmlBeanFactory(java.lang.String filename,
BeanFactory parentBeanFactory)
Creates new XmlBeanFactory using java.io to read the XML document with the given filename |
| Methods inherited from class com.interface21.beans.factory.support.ListableBeanFactoryImpl |
getBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getDefaultParentBean, preInstantiateSingletons, registerBeanDefinition, registerBeanDefinitions, registerBeanDefinitions, setDefaultParentBean, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
XmlBeanFactory
public XmlBeanFactory(java.lang.String filename,
BeanFactory parentBeanFactory)
throws BeansException
- Creates new XmlBeanFactory using java.io to read the XML document with the given filename
- Parameters:
filename - name of the file containing the XML documentparentBeanFactory - parent bean factory
XmlBeanFactory
public XmlBeanFactory(java.lang.String filename)
throws BeansException
- Creates new XmlBeanFactory using java.io to read the XML document with the given filename
- Parameters:
filename - name of the file containing the XML document
XmlBeanFactory
public XmlBeanFactory(java.io.InputStream is,
BeanFactory parentBeanFactory)
throws BeansException
- Create a new XmlBeanFactory with the given input stream,
which must be parsable using DOM.
- Parameters:
is - InputStream containing XMLparentBeanFactory - parent bean factory- Throws:
BeansException -
XmlBeanFactory
public XmlBeanFactory(java.io.InputStream is)
throws BeansException
- Create a new XmlBeanFactory with the given input stream,
which must be parsable using DOM.
- Parameters:
is - InputStream containing XML- Throws:
BeansException -
XmlBeanFactory
public XmlBeanFactory(org.w3c.dom.Document doc,
BeanFactory parentBeanFactory)
throws BeansException
- Creates new XmlBeanFactory from a DOM document
- Parameters:
doc - DOM document, already parsedparentBeanFactory - parent bean factory
XmlBeanFactory
public XmlBeanFactory(org.w3c.dom.Document doc)
throws BeansException
- Creates new XmlBeanFactory from a DOM document
- Parameters:
doc - DOM document, already parsed
Rod Johnson and Spring contributors 2001-2003.