Spring中ClassPathXmlApplicationContext与FileSystemXmlApplicationContext

ClassPathXmlApplicationContext与FileSystemXmlApplicationContext都是ApplicationContext类型的DI容器

而ClassPathXmlApplicationContext会从类路径上查找Spring XML配置文件,FileSystemXmlApplicationContext容器从文件系统获得信息。

eg

ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
 
ApplicationContext context = new FileSystemXmlApplicationContext("E:\\labDemo\\src\\applicationContext.xml");
		

你可能感兴趣的:(spring,Hibernate,struts)