public PersistantServiceImpl() { try { BeanFactory factory = new XmlBeanFactory( new ClassPathResource("mypackage/dao/beans.xml")); this.articlesdao = (ArticlesDAO) factory.getBean("articlesDAO"); } catch (Exception e) { System.out.println(e.toString()); System.exit(0); } }