Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

5.6. 

			
    @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 "";
    }