public class

XmlBeanFactory

extends DefaultListableBeanFactory
java.lang.Object
   ↳ org.springframework.core.SimpleAliasRegistry
     ↳ org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
       ↳ org.springframework.beans.factory.support.FactoryBeanRegistrySupport
         ↳ org.springframework.beans.factory.support.AbstractBeanFactory
           ↳ org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
             ↳ org.springframework.beans.factory.support.DefaultListableBeanFactory
               ↳ org.springframework.beans.factory.xml.XmlBeanFactory

This class is deprecated.
as of Spring 3.1 in favor of DefaultListableBeanFactory and XmlBeanDefinitionReader

Class Overview

Convenience extension of DefaultListableBeanFactory that reads bean definitions from an XML document. Delegates to XmlBeanDefinitionReader underneath; effectively equivalent to using an XmlBeanDefinitionReader with a DefaultListableBeanFactory.

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 DefaultListableBeanFactory 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. See "spring-beans-3.x.xsd" (or historically, "spring-beans-2.0.dtd") for details on options and configuration style.

For advanced needs, consider using a DefaultListableBeanFactory with an XmlBeanDefinitionReader. The latter allows for reading from multiple XML resources and is highly configurable in its actual XML parsing behavior.

Summary

[Expand]
Inherited Constants
From interface org.springframework.beans.factory.BeanFactory
From interface org.springframework.beans.factory.config.AutowireCapableBeanFactory
From interface org.springframework.beans.factory.config.ConfigurableBeanFactory
[Expand]
Inherited Fields
From class org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
Public Constructors
XmlBeanFactory(Resource resource)
Create a new XmlBeanFactory with the given resource, which must be parsable using DOM.
XmlBeanFactory(Resource resource, BeanFactory parentBeanFactory)
Create a new XmlBeanFactory with the given input stream, which must be parsable using DOM.
[Expand]
Inherited Methods
From class org.springframework.beans.factory.support.DefaultListableBeanFactory
From class org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
From class org.springframework.beans.factory.support.AbstractBeanFactory
From class org.springframework.beans.factory.support.FactoryBeanRegistrySupport
From class org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
From class org.springframework.core.SimpleAliasRegistry
From class java.lang.Object
From interface org.springframework.beans.factory.BeanFactory
From interface org.springframework.beans.factory.HierarchicalBeanFactory
From interface org.springframework.beans.factory.ListableBeanFactory
From interface org.springframework.beans.factory.config.AutowireCapableBeanFactory
From interface org.springframework.beans.factory.config.ConfigurableBeanFactory
From interface org.springframework.beans.factory.config.ConfigurableListableBeanFactory
From interface org.springframework.beans.factory.config.SingletonBeanRegistry
From interface org.springframework.beans.factory.support.BeanDefinitionRegistry
From interface org.springframework.core.AliasRegistry

Public Constructors

public XmlBeanFactory (Resource resource)

Create a new XmlBeanFactory with the given resource, which must be parsable using DOM.

Parameters
resource XML resource to load bean definitions from
Throws
BeansException in case of loading or parsing errors

public XmlBeanFactory (Resource resource, BeanFactory parentBeanFactory)

Create a new XmlBeanFactory with the given input stream, which must be parsable using DOM.

Parameters
resource XML resource to load bean definitions from
parentBeanFactory parent bean factory
Throws
BeansException in case of loading or parsing errors