应用配置文件 [英] Application configuration files

查看:399
本文介绍了应用配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我不想在这里开始一场神圣的战争,但是我们正在努力巩固我们处理应用程序配置文件的方式,我们正努力做出最好的决定。采取的方法。目前,我们分发的每个应用程序都使用它自己的ad-hoc配置文件,无论是属性文件(ini样式),XML还是JSON(目前仅在内部使用!)。



我们的大部分代码目前都是Java,所以我们一直在关注 Apache Commons Config ,但我们发现它非常冗长。我们还查看了 XMLBeans ,但似乎有很多不为人知的事情。我也觉得好像我被推向XML作为一种格式,但我的客户和同事都对尝试别的东西感到担忧。我可以从客户的角度理解它,每个人都听说过XML,但是在一天结束时,不应该使用正确的工具吗?



什么格式和库是人们现在在生产系统中使用的,是否有其他人试图避免使用角支架税收



编辑:确实需要成为跨平台的解决方案:Linux,Windows,Solaris等选择用于与配置文件接口的库与选择格式同样重要。

解决方案

XML XML XML XML。我们在这里讨论配置文件。如果您没有在性能密集的情况下序列化对象,则没有角括号税。



除了机器可读之外,配置文件必须是人类可读且易于理解的。 XML是两者之间的一个很好的折衷方案。



如果您的商店有人害怕那种新奇的XML技术,我会为您感到难过。


OK, so I don't want to start a holy-war here, but we're in the process of trying to consolidate the way we handle our application configuration files and we're struggling to make a decision on the best approach to take. At the moment, every application we distribute is using it's own ad-hoc configuration files, whether it's property files (ini style), XML or JSON (internal use only at the moment!).

Most of our code is Java at the moment, so we've been looking at Apache Commons Config, but we've found it to be quite verbose. We've also looked at XMLBeans, but it seems like a lot of faffing around. I also feel as though I'm being pushed towards XML as a format, but my clients and colleagues are apprehensive about trying something else. I can understand it from the client's perspective, everybody's heard of XML, but at the end of the day, shouldn't be using the right tool for the job?

What formats and libraries are people using in production systems these days, is anyone else trying to avoid the angle bracket tax?

Edit: really needs to be a cross platform solution: Linux, Windows, Solaris etc. and the choice of library used to interface with configuration files is just as important as the choice of format.

解决方案

XML XML XML XML. We're talking config files here. There is no "angle bracket tax" if you're not serializing objects in a performance-intense situation.

Config files must be human readable and human understandable, in addition to machine readable. XML is a good compromise between the two.

If your shop has people that are afraid of that new-fangled XML technology, I feel bad for you.

这篇关于应用配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆