1、classpath 路径在每个J2ee项目中都会用到,即WEB-INF下面的classes目录

2、配置文件中:

classpath 和 classpath* 区别: 
classpath:只会到你的class路径中查找找文件; 
classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找. 

 

3、eg.

(1)ApplicationContext ctx = new ClassPathXmlApplicationContext("xxxx.xml");  //读取classPath下的xxxx.xml配置文件
(2)ApplicationContext ctx = new FileSystemXmlApplicationContext("WebRoot/WEB-INF/xxxx.xml");   //读取WEB-INF 下的xxxx.xml配置文件
 
 
posted on 2019-01-22 11:34  唯忆学长  阅读(107)  评论(0编辑  收藏  举报