知乎专栏 |
@GetMapping("/properties") public String properties() { Properties properties = new Properties(); try { InputStreamReader inputStreamReader = new InputStreamReader(Objects.requireNonNull(this.getClass().getClassLoader().getResourceAsStream("application.properties")), StandardCharsets.UTF_8); properties.load(inputStreamReader); return properties.getProperty("app.id"); } catch (IOException e1) { e1.printStackTrace(); } return ""; }