public static void main(String[] args) { String result=getProjectConfig("max-file-size"); System.out.println(result); } public static String getProjectConfig(String key) { Properties pros = new Properties(); String value = ""; try { pros.load(new InputStreamReader(PropertiesUtil.class.getResourceAsStream("/application.yml"), "UTF-8")); value = pros.getProperty(key); } catch (Exception e) { return e.getMessage(); } return value; }