第六十四篇:commons-configuration使用介绍
来源:互联网 发布:网络语言20米是多少钱 编辑:程序博客网 时间:2024/06/06 05:02
commons-configuration
是Apache开源组织提供的用于操作配置文件的工具包。配置参数的来源可以是:Properties files、XML documents、Windows INI files、Property list files (plist)、JNDI、JDBC Datasource、System properties、Applet parameters和Servlet parameters。
下面为大家介绍几种常用的配置方法。
Properties files
首先我们创建一个属性文件,内容如下:
- 1
- 2
- 3
- 4
- 1
- 2
- 3
- 4
示例代码:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
运行结果:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 1
- 2
- 3
- 4
- 5
- 6
- 7
XML documents
同样的,我们先来创建一个xml文件
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
很熟悉有木有,这就是Java WEB项目的配置文件。
示例代码:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
运行结果:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
阅读全文
0 0
- 第六十四篇:commons-configuration使用介绍
- commons-configuration使用介绍
- 第六十二篇:commons-codec使用介绍
- Commons Configuration 介绍
- Commons Configuration 介绍
- 使用Commons Configuration
- Apache Commons Configuration 使用
- commons-configuration使用
- Commons Configuration使用
- commons-configuration 使用
- [j2ee]Apache Commons Configuration 使用
- 使用commons configuration管理配置文件
- Apache Commons configuration使用入门
- Apache Commons Configuration使用入门
- Apache Commons Configuration使用入门
- Apache Commons Configuration使用入门
- commons-configuration-1.5.jar简单介绍
- 使用commons的Configuration读取XML
- Asp.Net Core-项目结构
- 分布式系统事务一致性解决方案
- 史上最强的Vim 配置文件(原版+中文改进版)
- 拖拽(可以封装成指令的形式 angular )
- jQuery 理解事件和动画
- 第六十四篇:commons-configuration使用介绍
- Astyle编程语言格式化工具的中文说明
- LintCode 带环链表(快慢指针法)
- TIKV副本一致性检查机制源码分析
- DevOps发展趋势分析之:安全篇
- 合唱队-华为机试
- Spring Task定时任务的配置和使用详解
- 面试问题redis和memcache有什么区别
- 摘取最多苹果数&&DP