读取properties配置文件信息
直接上代码了,很简单。
读取resourse.properties配置文件
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
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 }
测试:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 public class Test {
2 public static void main(String[] args) {
3 System.out.println(LoadProperties.getValue("aaa"));
4 }
5 }