public class SysConfig { private static final Properties properties = new Properties(); static{ Resource rs1 = new ClassPathResource("sys-config.properties"); try { properties.load(rs1.getInputStream()); } catch (Exception e) { e.printStackTrace(); } } public static String get(String key){ return properties.getProperty(key); } public static void main(String args[]){ SysConfig.get("emialUrl"); }}