org.springframework.beans.factory.xml

## Class XmlBeanFactory

- 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

- All Implemented Interfaces:
    Serializable, BeanFactory, AutowireCapableBeanFactory, ConfigurableBeanFactory, ConfigurableListableBeanFactory, SingletonBeanRegistry, HierarchicalBeanFactory, ListableBeanFactory, BeanDefinitionRegistry, AliasRegistry

  Deprecated.
  as of Spring 3.1 in favor of `DefaultListableBeanFactory` and `XmlBeanDefinitionReader`

      @Deprecated
      public class XmlBeanFactory
      extends DefaultListableBeanFactory

  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.

  Since:
    15 April 2001
  Author:
    Rod Johnson, Juergen Hoeller, Chris Beams
  See Also:
    `DefaultListableBeanFactory`, `XmlBeanDefinitionReader`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.springframework.beans.factory.support.DefaultSingletonBeanRegistry

      `logger, NULL_OBJECT`

    - ### Fields inherited from interface org.springframework.beans.factory.config.AutowireCapableBeanFactory

      `AUTOWIRE_AUTODETECT, AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_CONSTRUCTOR, AUTOWIRE_NO`

    - ### Fields inherited from interface org.springframework.beans.factory.config.ConfigurableBeanFactory

      `SCOPE_PROTOTYPE, SCOPE_SINGLETON`

    - ### Fields inherited from interface org.springframework.beans.factory.BeanFactory

      `FACTORY_BEAN_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XmlBeanFactory(Resource resource)` Deprecated. Create a new XmlBeanFactory with the given resource, which must be parsable using DOM.
    `XmlBeanFactory(Resource resource, BeanFactory parentBeanFactory)` Deprecated. Create a new XmlBeanFactory with the given input stream, which must be parsable using DOM.

  - ### Method Summary

    - ### Methods inherited from class org.springframework.beans.factory.support.DefaultListableBeanFactory

      `allowAliasOverriding, containsBeanDefinition, copyConfigurationFrom, destroySingleton, determinePrimaryCandidate, doResolveDependency, findAnnotationOnBean, findAutowireCandidates, freezeConfiguration, getAutowireCandidateResolver, getBean, getBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, isAutowireCandidate, isAutowireCandidate, isBeanEligibleForMetadataCaching, isConfigurationFrozen, isPrimary, matchesBeanName, preInstantiateSingletons, registerBeanDefinition, registerResolvableDependency, registerSingleton, removeBeanDefinition, resetBeanDefinition, resolveDependency, setAllowBeanDefinitionOverriding, setAllowEagerClassLoading, setAutowireCandidateResolver, setSerializationId, toString, writeReplace`

    - ### Methods inherited from class org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory

      `applyBeanPostProcessorsAfterInitialization, applyBeanPostProcessorsBeforeInitialization, applyBeanPostProcessorsBeforeInstantiation, applyBeanPropertyValues, applyMergedBeanDefinitionPostProcessors, applyPropertyValues, autowire, autowireBean, autowireBeanProperties, autowireByName, autowireByType, autowireConstructor, checkDependencies, configureBean, createBean, createBean, createBean, createBeanInstance, determineConstructorsFromBeanPostProcessors, doCreateBean, filterPropertyDescriptorsForDependencyCheck, filterPropertyDescriptorsForDependencyCheck, getEarlyBeanReference, getInstantiationStrategy, getParameterNameDiscoverer, getTypeForFactoryBean, getTypeForFactoryMethod, ignoreDependencyInterface, ignoreDependencyType, initializeBean, initializeBean, instantiateBean, instantiateUsingFactoryMethod, invokeCustomInitMethod, invokeInitMethods, isExcludedFromDependencyCheck, populateBean, postProcessObjectFromFactoryBean, predictBeanType, removeSingleton, resolveBeforeInstantiation, resolveDependency, setAllowCircularReferences, setAllowRawInjectionDespiteWrapping, setInstantiationStrategy, setParameterNameDiscoverer, unsatisfiedNonSimpleProperties`

    - ### Methods inherited from class org.springframework.beans.factory.support.AbstractBeanFactory

      `addBeanPostProcessor, addEmbeddedValueResolver, addPropertyEditorRegistrar, afterPrototypeCreation, beforePrototypeCreation, checkMergedBeanDefinition, clearMergedBeanDefinition, containsBean, containsLocalBean, copyRegisteredEditorsTo, destroyBean, destroyBean, destroyScopedBean, doGetBean, evaluateBeanDefinitionString, getAccessControlContext, getAliases, getBean, getBean, getBean, getBean, getBeanClassLoader, getBeanExpressionResolver, getBeanPostProcessorCount, getBeanPostProcessors, getConversionService, getCustomEditors, getCustomTypeConverter, getMergedBeanDefinition, getMergedBeanDefinition, getMergedBeanDefinition, getMergedLocalBeanDefinition, getObjectForBeanInstance, getParentBeanFactory, getPropertyEditorRegistrars, getRegisteredScope, getRegisteredScopeNames, getTempClassLoader, getType, getTypeConverter, hasDestructionAwareBeanPostProcessors, hasInstantiationAwareBeanPostProcessors, initBeanWrapper, isActuallyInCreation, isBeanNameInUse, isCacheBeanMetadata, isFactoryBean, isFactoryBean, isPrototype, isPrototypeCurrentlyInCreation, isSingleton, isTypeMatch, markBeanAsCreated, originalBeanName, registerCustomEditor, registerCustomEditors, registerDisposableBeanIfNecessary, registerScope, removeSingletonIfCreatedForTypeCheckOnly, requiresDestruction, resolveBeanClass, resolveEmbeddedValue, setBeanClassLoader, setBeanExpressionResolver, setCacheBeanMetadata, setConversionService, setParentBeanFactory, setSecurityContextProvider, setTempClassLoader, setTypeConverter, transformedBeanName`

    - ### Methods inherited from class org.springframework.beans.factory.support.FactoryBeanRegistrySupport

      `getCachedObjectForFactoryBean, getFactoryBean, getObjectFromFactoryBean, getTypeForFactoryBean`

    - ### Methods inherited from class org.springframework.beans.factory.support.DefaultSingletonBeanRegistry

      `addSingleton, addSingletonFactory, afterSingletonCreation, beforeSingletonCreation, containsSingleton, destroyBean, destroySingletons, getDependenciesForBean, getDependentBeans, getSingleton, getSingleton, getSingleton, getSingletonCount, getSingletonMutex, getSingletonNames, hasDependentBean, isCurrentlyInCreation, isSingletonCurrentlyInCreation, onSuppressedException, registerContainedBean, registerDependentBean, registerDisposableBean, setCurrentlyInCreation`

    - ### Methods inherited from class org.springframework.core.SimpleAliasRegistry

      `canonicalName, checkForAliasCircle, isAlias, registerAlias, removeAlias, resolveAliases`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.springframework.beans.factory.config.ConfigurableListableBeanFactory

      `ignoreDependencyInterface, ignoreDependencyType`

    - ### Methods inherited from interface org.springframework.beans.factory.config.AutowireCapableBeanFactory

      `applyBeanPostProcessorsAfterInitialization, applyBeanPostProcessorsBeforeInitialization, applyBeanPropertyValues, autowire, autowireBean, autowireBeanProperties, configureBean, createBean, createBean, initializeBean, resolveDependency`

    - ### Methods inherited from interface org.springframework.beans.factory.config.ConfigurableBeanFactory

      `addBeanPostProcessor, addEmbeddedValueResolver, addPropertyEditorRegistrar, copyRegisteredEditorsTo, destroyBean, destroyScopedBean, destroySingletons, getAccessControlContext, getBeanClassLoader, getBeanExpressionResolver, getBeanPostProcessorCount, getConversionService, getDependenciesForBean, getDependentBeans, getMergedBeanDefinition, getRegisteredScope, getRegisteredScopeNames, getTempClassLoader, getTypeConverter, isCacheBeanMetadata, isCurrentlyInCreation, isFactoryBean, registerAlias, registerCustomEditor, registerDependentBean, registerScope, resolveAliases, resolveEmbeddedValue, setBeanClassLoader, setBeanExpressionResolver, setCacheBeanMetadata, setConversionService, setCurrentlyInCreation, setParentBeanFactory, setTempClassLoader, setTypeConverter`

    - ### Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory

      `containsLocalBean, getParentBeanFactory`

    - ### Methods inherited from interface org.springframework.beans.factory.BeanFactory

      `containsBean, getAliases, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch`

    - ### Methods inherited from interface org.springframework.beans.factory.config.SingletonBeanRegistry

      `containsSingleton, getSingleton, getSingletonCount, getSingletonNames`

    - ### Methods inherited from interface org.springframework.beans.factory.support.BeanDefinitionRegistry

      `isBeanNameInUse`

    - ### Methods inherited from interface org.springframework.core.AliasRegistry

      `getAliases, isAlias, registerAlias, removeAlias`

- - ### Constructor Detail

    - #### XmlBeanFactory

          public XmlBeanFactory(Resource resource)
                         throws BeansException

      Deprecated.
      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

    - #### XmlBeanFactory

          public XmlBeanFactory(Resource resource,
                        BeanFactory parentBeanFactory)
                         throws BeansException

      Deprecated.
      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