Resource resource = new ClassPathResource("bean.xml"); BeanFactory factory = new XmlBeanFactory(resource);