欢迎大家加入我的github项目,一起学习,一起发展
---> 全栈工程师进阶学习站
---> 我的前端学习笔记
--->行业内最新最群的报告,工作日每日更新
Properties props = new Properties();
// props.load(JedisPoolUtil.class.getClassLoader().getResourceAsStream("jedis.properties"));
ResourceBundle bundle = ResourceBundle.getBundle("jedis");
//获取数据,加载到jedisPoolConfig下
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
// jedisPoolConfig.setMaxTotal(Integer.parseInt(props.getProperty("maxTotal")));
jedisPoolConfig.setMaxTotal(Integer.parseInt(bundle.getString("maxTotal")));
// jedisPoolConfig.setMaxIdle(Integer.parseInt(props.getProperty("maxIdle")));
jedisPoolConfig.setMaxIdle(Integer.parseInt(bundle.getString("maxIdle")));
//初始化 jedisPool
// jedisPool= new JedisPool(jedisPoolConfig, props.getProperty("host"), Integer.parseInt(props.getProperty("port")));
jedisPool= new JedisPool(jedisPoolConfig, bundle.getString("host"), Integer.parseInt(bundle.getString("port")));
使用ResourceBundle替代properties类
要注意的是资源路径前面不要加斜杠,并且不需要文件拓展名(前提是必须是properties)
如果是properties类的话,需要加斜杠
```闲聊时刻
10年短信公司,互联网100强企业!主营业务:短信(国内和国际)App H5一键免密登录,防薅羊毛接口,图片OCR,空号检测,活跃号检测,人证核验,活体检测,高防ddos攻击等等200多个企业服务接口!需要的联系他13592366783 官方链接:https://zz.253.com/v5.html#/register?uid=1953
自己公司需求 偶然间 用了一家第三方接口供应商,产品应有尽有,很齐全,对接文档非常详细,彼此都很节约时间,主要非常稳定,包括服务方面很给力,有兴趣的博友,可以联系他,算是对合作伙伴的支持了