四步:

java代码

//new一个读取配置文件
        Properties properties=new Properties();
        //获取文件路径
        String path=request.getServletContext().getRealPath("/dom.properties");
        //读取文件内容
        properties.load(new FileInputStream(path));
        //获取origin的value
        String origin=properties.getProperty("origin");

配置文件代码

origin=http://localhost:7070, http://localhost:8080, http://localhost:9090

java读取资源文件(Properties)

 

java读取资源文件(Properties)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
  • 2021-12-19
  • 2021-05-19
  • 2022-01-16
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-22
  • 2022-01-22
相关资源
相似解决方案