读取properties配置文件工具类
来源:互联网 发布:python量化交易 编辑:程序博客网 时间:2024/06/03 20:40
package com.ule.util;import java.io.BufferedInputStream;import java.io.FileInputStream;import java.io.InputStream;import java.util.Properties;public class PropertiesUtils { /** * (注意:加载的是src下的文件,如果在某个包下.请把包名加上) * @return */ public static Properties getProperties(String sourcesFileName){ Properties properties = new Properties(); String savePath = Thread.currentThread().getContextClassLoader().getResource(sourcesFileName).getPath(); try{ InputStream inputStream = new BufferedInputStream(new FileInputStream(savePath)); properties.load(inputStream); }catch (Exception e){ e.printStackTrace(); } return properties; } /** * 获取属性文件的数据 根据key获取值 * @param key * @return */ public static String findPorpertyByKey(String key,String sourcesFileName){ try { Properties pro = getProperties(sourcesFileName); return pro.getProperty(key); }catch (Exception e){ return ""; } }}
0 0
- 读取.properties配置文件工具类!!!
- 读取Properties配置文件工具类
- 读取配置文件properties工具类
- properties配置文件读取工具类
- 读取properties配置文件工具类
- 读取properties配置文件的工具类
- properties配置文件的读取工具类
- 读取properties配置文件的工具类
- 读取properties配置文件的工具类
- java 数据库读取工具类(读取config.properties配置文件)
- java 数据库读取工具类(读取config.properties配置文件)
- 工具(一):properties配置文件读取工具类
- XMLUtil工具类读取XML或properties格式的配置文件
- 针对config.properties的配置文件读取的工具类
- Properties 读取工具类
- 读取Properties工具类
- 配置文件Properties读取类 ResourceBundle
- 加载properties配置文件工具类
- 页面自适应
- IIS请求筛选模块被配置为拒绝超过请求内容长度的请求
- CentOS 7配置OpenVPN踩坑记录
- JAVA日期格式化
- 详解工厂模式
- 读取properties配置文件工具类
- lua 统计字符集中出现的次数
- 清除手机tap事件后element 时候出现的一个高亮
- 【Java基础】RTTI和Java反射机制
- mysql 存储过程
- ping 相关
- oc简单排序问题
- 笔记-<协同函数>
- 递归递推练习D汉诺塔系列1