propertiesloader.java
来自「java三层架构(MVC)实现的在线图书销售系统。其中应用到工厂」· Java 代码 · 共 54 行
JAVA
54 行
package accp.yyw.model.tool;import java.util.Properties;import java.util.PropertyResourceBundle;import java.util.Enumeration;import java.io.FileNotFoundException;/** * <p>Title: BookShop</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: accp</p> * @author yyw * @version 1.0 */public class PropertiesLoader { private java.util.Properties properties; public PropertiesLoader() { super(); } public java.util.Properties getProperties(String propertiesfilename) throws java.io.FileNotFoundException { if (properties == null) { java.util.PropertyResourceBundle propertyresourcebundle = null; System.out.print("Loading configuration from FILES(" + propertiesfilename + ".properties)..."); propertyresourcebundle = (PropertyResourceBundle) PropertyResourceBundle.getBundle(propertiesfilename); System.out.println(" ok !"); Enumeration enumeration = propertyresourcebundle.getKeys(); properties = new Properties(); while (enumeration.hasMoreElements()) { String propertyname = enumeration.nextElement().toString(); properties.setProperty(propertyname,propertyresourcebundle.getString(propertyname)); } } return properties; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?