读配置文件取配置参数工具类PropertiesUtil

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yulidrff/article/details/85335100
public class PropertiesUtil {

	private static Properties properties = new Properties();

	static {
		InputStream in = PropertiesUtil.class.getResourceAsStream("/config.properties");
		try {
			properties.load(in);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static String get(String key) {
		return properties.getProperty(key).trim();
	}
}

猜你喜欢

转载自blog.csdn.net/yulidrff/article/details/85335100