================typesafeconfig的使用====================

#1、加入依赖包 config-1.2.1.jar

#2、加载配置

ConfigFactory.parseFile(new File("resource/test.conf"));

ConfigFactory.load(test)

#3、getString(key)方法获取

config1.getString("complex-app.something")

// ConfigFactory.parseString使用parseString直接解析
            Config config2 = ConfigFactory.parseString("akka.loggers =            \"akka.testkit.TestEventListener\"");
            System.out.println(config2.getString("akka.loggers"));
            
  // 使用parseString 直接解析json字符串
            Config config3 = ConfigFactory.parseString("{\"a\":\"b\", \"c\":\"d\"}");
            System.out.println(config3.getString("a"));
            System.out.println(config3.getString("c"));

#4、合并配置文件

Config firstConfig = ConfigFactory.parseFile(new File("resource/test.conf"));
            Config secondConfig =ConfigFactory.parseFile(new File("resource/test1.conf"));
            //a.withFallback(b)  a和b合并,如果有相同的key,以a为准
            Config finalConfig = firstConfig.withFallback(secondConfig);

最新文章

  1. 实例学习SQL的Select命令
  2. git远程分支
  3. 团队开发——冲刺2.b
  4. 虚拟化之esxi命令行管理
  5. windows2003 64位 iis6.0 运行32位web应用程序
  6. Android5.0之Toobar的使用
  7. 学习在创建好的工程里面添加CoreData
  8. table边框不显示
  9. LNK快捷方式漏洞利用方式 exp制作教程
  10. 用户登录(Material Design + Data-Binding + MVP架构模式)实现
  11. Oracle数据文件丢失,数据库如何打开或恢复
  12. 学习如何设置ssh安全只允许用户从指定的IP登陆
  13. iOS Icon Size 快速得到三种大小的图标
  14. ss简单使用
  15. php方法重载
  16. 在spring boot上基于maven使用redis——批量匹配并删除 (二)
  17. pyQt: eg3
  18. 搞懂分布式技术28:微服务(Microservice)那点事
  19. .netCore2.0 部分视图ViewComponent
  20. yaml语法

热门文章

  1. 数据结构自己实现——Tree and Forest
  2. 洛谷——P1126 机器人搬重物
  3. 1005 Spell It Right
  4. linux tomcat shutdown.sh 有时不能结束进程,使用如下指令进度重启
  5. Spring MVC中@ControllerAdvice注解实现全局异常拦截
  6. Interface Builder中的技巧
  7. cocos2d-x step by step(3) Doub le Kill简单的一些小动画
  8. 调用tensorflow中的concat方法时Expected int32, got list containing Tensors of type '_Message' instead.
  9. Controller 层实现
  10. python(4)- 简单练习:python实现购物车的优化