ClassPathXmlApplicationContext

ApplicationContext context = new ClassPathXmlApplicationContext("service.xml");

if (ac.containsBean("swmsBussinessCodeManager")) {  

     BussinessCodeManager codeManager =       (BussinessCodeManager)ac.getBean("swmsBussinessCodeManager");

}

如果是两个以上:
ApplicationContext ac = new ClassPathXmlApplicationContext(new String[]{"applicationContext.xml","dao.xml"});

或者用通配符:
ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:/*.xml");

 

 

你可能感兴趣的:(ClassPathXmlApplicationContext)