properties

  • 读取配置文件
/*加载配置文件*/
//从classpath中加载配置文件
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream inputStream = loader.getResourceAsStream("xx.properties");
Properties properties = new Properties();
properties.load(inputStream);
properties.getProperty("key");

你可能感兴趣的:(properties)