Browse Source

属性操作工具

master
xyiege 4 years ago
parent
commit
91d64fd3d5
  1. 15
      conf/szwh.properties
  2. 31
      src/main/java/cn/chjyj/szwh/utils/ProperUtils.java

15
conf/szwh.properties

@ -10,4 +10,17 @@ entrust.pem.prikey.path=/conf/cert/entrust/private_key.pem
entrust.pem.pubkey.path=/conf/cert/entrust/public_key.pem
#资源下载
distribute。pem.prikey.path=/conf/cert/distribute/private_key.pem
distribute.pem.pubkey.path=/conf/cert/distribute/public_key.pem
distribute.pem.pubkey.path=/conf/cert/distribute/public_key.pem
# 分发系统地址
ENTRUST_URL = http://10.24.4.14:51317
# 交易系统地址
TIANLANG_ENTRUST_URL =http://10.24.4.90:11030
# 用户地址
REAL_URL =http://10.24.4.14:51317
# 主机
HOST =http://10.24.4.156
# 中间件
MIDDLEWARE_HOST =http://116.77.235.153:8989
# 渠道用户
CHANNEL_ISLI =999998-000000001920-2

31
src/main/java/cn/chjyj/szwh/utils/ProperUtils.java

@ -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…
Cancel
Save