java读取properties配置文件路径

读取properties文件里的某属性

  /**
   * 读取文件库配置文件
   */
  Properties properties = new Properties();
  InputStream ips = ImageServiceImpl.class.getClassLoader().getResourceAsStream("config.properties");
  properties.load(ips);
  String path = properties.getProperty("imagePath");
  String servicePath = properties.getProperty("imageServicePath");
  

读取Resource文件夹下的文件

InputStream file = this.getClass().getResourceAsStream("/templates/statistics/templatesfileExcel/阿斯顿.xlsx");

Guess you like

Origin blog.csdn.net/weixin_48860638/article/details/121384290