What is the best strategy for loading property and configuration files in Java?

junhongsh 2012-08-25 10:18:55
When you think about how to load an external resource in Java, several options immediately come to mind: files, classpath resources, and URLs. Although all of them eventually get the job done, experience shows that classpath resources and URLs are by far the most flexible and user-friendly options.

In general, a configuration file can have an arbitrarily complex structure (e.g., an XML schema definition file). But for simplicity, I assume below that we're dealing with a flat list of name-value pairs (the familiar .properties format). There's no reason, however, why you can't apply the ideas shown below in other situations, as long as the resource in question is constructed from an InputStream.

read the full article

http://www.java101.net/thread/viewthread.xhtml?id=180
...全文
193 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
junhongsh 2012-08-25
  • 打赏
  • 举报
回复
Sorry the link is wrong, Here is the correct one.

http://www.java101.net/thread/viewthread.xhtml?id=174
junhongsh 2012-08-25
  • 打赏
  • 举报
回复
you may want to take a look at this one too.

http://www.java101.net/thread/viewthread.xhtml?id=174r

62,621

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧