加载src下的properties文件

public class ProsUtil {
	private static Log log = LogFactory.getLog(ProsUtil.class);
	private static Properties pros;
	static {
		pros = new Properties();
		try {
			pros.load(ProsUtil.class.getClassLoader().getResourceAsStream("sql.properties"));
			log.info("--->加载sql.properties成功!");
		} catch (Exception e) {
			log.error(e.getMessage());
		}
	}

	public static String getParameterValue(String key) {
		return pros.getProperty(key);
	}
}
 

 

你可能感兴趣的:(sql)