需要将一些 易变 的 配置参数
放置再 XML 配置文件 或者 properties 配置文件中。
基于ClassLoder读取配置文件:【该方式只能读 类路径下 的配置文件】
Properties properties = new Properties();
// 使用ClassLoader加载properties配置文件生成对应的输入流
InputStream in = PropertiesMain.class.getClassLoader().getResourceAsStream("config/config.properties");
// 使用properties对象加载输入流
properties.load(in);
//获取key对应的value值
properties.getProperty(String key);