0

How to use Spring XmlBeanFactory

Background

XmlBeanFactory is one of Spring’s containers that provide dependency injection. Note that it has been deprecated already. This means that you should not use this in new development projects.

Software Environment

  • Windows 7 Professional SP1
  • Eclipse – Kepler Release
  • Java 1.7 (1.7.0_67 – Windows x86)
  • Spring Framework
    • Spring Context 4.1.2

Maven Dependencies

Bean Configuration File

A bean configration file is an XML file that contains all objects instantiated when the container starts.

JavaBeans

AnimalBean.java

PersonBean.java

The Main Class

Sample Output

Download the Project

https://www.dropbox.com/s/tfcxwdj2x49jx1i/turretaSpringDIBeanFactory.zip?dl=0

 

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert