2 changed files with 45 additions and 1 deletions
@ -0,0 +1,31 @@ |
|||||
|
package cn.chjyj.szwh.utils; |
||||
|
|
||||
|
import cn.chjyj.szwh.constant.ChConstant; |
||||
|
import cn.chjyj.szwh.exception.ChException; |
||||
|
|
||||
|
import java.io.FileReader; |
||||
|
import java.util.Properties; |
||||
|
|
||||
|
/** |
||||
|
* 属性工具 |
||||
|
*/ |
||||
|
public class ProperUtils { |
||||
|
/** |
||||
|
* 读取配置文件中的某个键 |
||||
|
* @param key |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String getSzwhProp(String key){ |
||||
|
String kval=""; //返回的配置值
|
||||
|
// 资源文件
|
||||
|
String szconf = ChConstant.WORK_DIR + ChConstant.SZWH_CONF; |
||||
|
Properties prop = new Properties(); |
||||
|
try { |
||||
|
prop.load(new FileReader(szconf)); |
||||
|
kval=prop.getProperty(key);//私钥路径
|
||||
|
}catch (Exception ex){ |
||||
|
throw new ChException("配置文件"+ChConstant.SZWH_CONF+"不存在"); |
||||
|
} |
||||
|
return kval; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue