无论配置文件放在类路径(src)下的哪个包中,都可以通过这种方式找到:

   Properties prop = new Properties();
   
   InputStream is = 当前类名.class.getClassLoader().getResourceAsStream("配置文件名.properties");


   prop.load(is);

相关文章:

  • 2022-02-09
  • 2021-09-22
  • 2021-11-06
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2021-11-18
  • 2021-08-25
相关资源
相似解决方案