Your spring.xml
isn't on your classpath, it resides somewhere on your file system. Your XmlBeanFactory
is loading the file from the file system the ClassPathXmlApplicationContext
defaults to the classpath.
Either move the file to your classpath or modify the constructing of ClassPathXmlApplicationContext
and prefix with file:
.
BeanFactory factoryObj = new ClassPathXmlApplicationContext("file:spring.xml");