码迷,mamicode.com
首页 > Web开发 > 详细

三种格式文件比较 .properties .conf .json

时间:2015-03-04 19:14:43      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:

The three file formats each have advantages.

  • Java .properties:
    • Java standard, built in to JVM
    • Supported by many tools such as IDEs
  • JSON:
    • easy to generate programmatically
    • well-defined and standard
    • bad for human maintenance, with no way to write comments, and no mechanisms to avoid duplication of similar config sections
  • HOCON/.conf:
    • nice for humans to read, type, and maintain, with more lenient syntax
    • built-in tools to avoid cut-and-paste
    • ways to refer to the system environment, such as system properties and environment variables

The idea would be to use JSON if you‘re writing a script to spit out config, and use HOCON if you‘re maintaining config by hand. If you‘re doing both, then mix the two.

三种格式文件比较 .properties .conf .json

标签:

原文地址:http://blog.csdn.net/wangjuntytl/article/details/44062431

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!