Java加载默认配置
示例
要读取默认配置属性:
package com.example; public class ExampleApplication { private Properties getDefaults() throws IOException { Properties defaults = new Properties(); try (InputStream defaultsStream = ExampleApplication.class.getResourceAsStream("config.properties")) { defaults.load(defaultsStream); } return defaults; } }