import java.util.Enumeration;
import java.util.LinkedHashMap;
import java.util.Properties;
import org.apache.log4j.Logger;
public class ConstantPropertyInfo {
private static Logger log = Logger.getLogger(ConstantPropertyInfo.class);
public static LinkedHashMap<String, String> getInfo(String url) {
LinkedHashMap<String, String> info = new LinkedHashMap<String, String>();
Properties properties = new Properties();
try {
properties.load(ConstantPropertyInfo.class.getClassLoader()
.getResourceAsStream(url));
Enumeration<?> enu = properties.propertyNames();
String key = null;
while (enu.hasMoreElements()) {
key = String.valueOf(enu.nextElement());
info.put(key, properties.getProperty(key));
}
} catch (Exception e) {
log.error("");
}
return info;
}
}
//调用方法
LinkedHashMap<String, String> info = ConstantPropertyInfo.getInfo("路径");
String logo=info.get("logo");