读取properties配置文件信息

直接上代码了,很简单。

读取resourse.properties配置文件 

读取properties配置文件
 1 import java.util.ResourceBundle;
2
3 public class LoadProperties {
4 private static ResourceBundle cache=null;
5 static{
6 cache=ResourceBundle.getBundle("resourse");
7 }
8
9 public static String getValue(String key){
10 return cache.getString(key);
11 }
12 }

测试:

Test类
1 public class Test {
2 public static void main(String[] args) {
3 System.out.println(LoadProperties.getValue("aaa"));
4 }
5 }

 



 

posted @ 2012-03-14 20:01  Paul.Lau  阅读(179)  评论(0编辑  收藏  举报