首页 > 编程语言 > 详细

java读取属性配置文件工具类

时间:2015-07-17 11:44:49      阅读:178      评论:0      收藏:0      [点我收藏+]

 

 1 import java.io.IOException;
 2 import java.io.InputStream;
 3 import java.util.Properties;
 4 /**
 5  * 
 6  * 类: ProUtil <br>
 7  * 描述: 属性配置文件读取类 <br>
 8  * 作者: poseidon<br>
 9  * 版本: 1.0<br>
10  * 时间: 2015-7-17 上午09:20:17
11  */
12 public class ProUtil {
13     public static Properties  propertie =null;
14     static {
15          propertie = new Properties();
16         InputStream inputStream = ProUtil.class.getResourceAsStream("/config.properties");
17         try {
18             propertie.load(inputStream);
19             inputStream.close();
20         } catch (IOException e) {
21         }
22     }
23     
24     public static void main(String[] args) {
25         System.out.println("--->"+ProUtil.propertie.get("username"));  //username
26     }
27 }

 

java读取属性配置文件工具类

原文:http://www.cnblogs.com/sun-rain/p/4653499.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!