首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 系统运维 >

Spring ClassPathXmlApplicationContext和FileSystemXmlApplicationContext路径有关问题

2012-07-26 
SpringClassPathXmlApplicationContext和FileSystemXmlApplicationContext路径问题/*//ApplicationContext

Spring ClassPathXmlApplicationContext和FileSystemXmlApplicationContext路径问题
/*
       //ApplicationContext ctx=new FileSystemXmlApplicationContext("src/main/resources/spring.xml");
       ApplicationContext ctx=new FileSystemXmlApplicationContext("file:e:/lib/spring.xml");
       Car car=(Car)ctx.getBean("car1");
       System.out.println(car.getName()+"\n"+car.getPrice());
       */
     
     //BeanFactory bf=new ClassPathXmlApplicationContext("spring.xml");
     BeanFactory bf=new ClassPathXmlApplicationContext("file:e:/lib/spring.xml");
     Car car=(Car)bf.getBean("car1");
     System.out.println(car.getName()+"\n"+car.getPrice());

热点排行