Springs XmlBeanFactory is deprecated
Here is the substitute code,
public static void main(String[] args){
ApplicationContext context=new ClassPathXmlApplicationContext(new String[]{"SpringHelloWorld.xml"});
BeanFactory factory=context;
Spring3HelloWorld myBean=(Spring3HelloWorld)factory.getBean("Spring3HelloWorldBean");
myBean.sayHello();
}
ApplicationContext is a sub-interface of BeanFactory.You can use this way
public class SpringHelloWorldTest {
public static void main(String[] args) {
ApplicationContext context= new ClassPathXmlApplicationContext("SpringHelloWorld.xml");
Spring3HelloWorld myBean= (Spring3HelloWorld) context.getBean("Spring3HelloWorldBean");
myBean.sayHello();
}
}
BeanDefinitionRegistry beanDefinitionRegistry = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanDefinitionRegistry);
reader.loadBeanDefinitions(new ClassPathResource("SPRING_CONFIGURATION_FILE"));