package java.util;
Properties p = SysProperties.INSTANCE.getSysProperties();
//取得sysconfig.properties配置文件中project_url的值
String project_url = p.getProperty("project_url");
SysProperties类
package com.els.common;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.Properties;
public enum SysProperties {
INSTANCE;
private SysProperties() {
}
public static final ThreadLocal<Map<String,String>> serviceMapping = new ThreadLocal<Map<String,String>>();
// public static Map<String,String> serviceMapping = new HashMap<String,String>();
public Properties getProperties(String fileName) {
Properties properties = null;
try {
InputStreamReader propertyIn = new InputStreamReader(
getClass().getClassLoader().getResourceAsStream(fileName), "UTF-8");
properties = new Properties();
properties.load(propertyIn);
} catch (IOException
获得配置文件properties的值
最新推荐文章于 2023-12-08 14:13:20 发布