applicationContext.xml路径

来源:互联网 发布:python字符串转数字 编辑:程序博客网 时间:2024/05/21 10:43
1:关于Spring中applicationContext.xml路径问题
对于ClassPathXmlApplicationContext(),classpath: 前缀是不需要的,默认就是指项目的classpath路径下面(src下面);
如果要使用绝对ClassPathXmlApplicationContext()路径,需要加上file: 前缀表示这是绝对路径;
如:1、ApplicationContext factory=new ClassPathXmlApplicationContext("applicationContext.xml");
   2、ApplicationContext factory=new ClassPathXmlApplicationContext("file:D:\workspace\SpringTest\src\applicationContext.xml");

2://读取文件

        File file = new File("C:\\Users\\xxx\\Desktop\\student.xls");

3:错误:
java.sql.SQLException: An attempt by a client to checkout a Connection has timed out (使用c3p0数据库连接池时出现com.mchange.v2.resourcepool.TimeoutException)
可能是你的连接数据库的参数设置错误,使得无法连接上数据库timed out

0 0
原创粉丝点击