你的位置:首页 > 软件开发 > Java > 工程中properties文件处理方法类

工程中properties文件处理方法类

发布时间:2016-06-05 15:00:03
功能:properties文件加载、取得key对应的值 1 import java.util.ResourceBundle; 2 3 /** 4 * 工程中properties文件处理方法类 5 */ 6 public class ConfigHolder { 7 pri ...

功能:properties文件加载、取得key对应的值

 1 import java.util.ResourceBundle; 2  3 /** 4  * 工程中properties文件处理方法类 5 */ 6 public class ConfigHolder { 7   private static ResourceBundle bundle; 8    9   /**10    * 加载properties文件11   */12   private static void loadConfig() {13     if(bundle == null) {14       // 在class下有config.properties文件,如果在某包下,则如:ort.config15       bundle = ResourceBundle.getBundle("config");16     }17   }18   19   /**20    * 取得properties文件中指定key的值21    * @param key22    * @return23   */24   public static String getValue(String key) {25     loadConfig();26     return bundle.getString(key);27   }  28 }

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:工程中properties文件处理方法类

关键词:ie

ie
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。