java读取配置文件
来源:互联网 发布:iphone照片mac air同步 编辑:程序博客网 时间:2024/04/27 20:50
参考:http://blog.sina.com.cn/s/blog_8af106960102v629.html
一般使用this.getClass().getResourceAsStream("/xxx.properties");适用于配置文件在src下的情况
也可以使用this.getClass().getClassLoader().getResource("").getPath();获取到当前类所在项目(服务器位置)的WEB-INF/classes/路径,比如:
String thispath = this.getClass().getClassLoader().getResource("").getPath();
System.out.println("hehehe=======================:"+thispath);
输出:hehehe=======================:/D:/work/selfServer/apache-tomcat-7.0.55/webapps/springMvc/WEB-INF/classes/
1 0
- java读取配置文件
- java读取配置文件
- java 读取properties配置文件
- Java读取properties配置文件
- JAVA读取配置文件路径
- java读取xml配置文件
- JAVA读取配置文件
- Java读取配置文件
- Java配置文件读取
- java读取xml配置文件
- java读取properties配置文件
- java 读取配置文件properties
- java读取配置文件
- Java读取配置文件
- java读取配置文件
- java读取配置文件property
- java 读取*.properties配置文件
- JAVA [ 配置文件的读取 ]
- maven常用命令
- [从头学数学] 第197节 统计案例
- 翻译mosHow to Switch to a New Undo Tablespace (文档 ID 1951695.1)使用新的undo表空间和删除旧的表空间
- 检测旋转词
- 新思路_Android同时显示多个跑马灯
- java读取配置文件
- HDU搬寝室DP
- Android 6.0运行时权限解决办法
- hive常见错误汇总
- 清华男的大学4年
- RxJava学习(三)
- 冒泡排序
- 【杭电-oj】-1859-最小长方形
- Unity中触摸和鼠标操作的几个问题