//创建Properties对象
Properties properties=new Properties();
1、获取class目录下的配置文件
ClassLoader classLoader = Reflection01.class.getClassLoader();
InputStream is = classLoader.getResourceAsStream("re.properties");
properties.load(is);
2、//直接用流加载
properties.load(new FileInputStream("src\\re.properties"));
加载properties文件的两种方法
最新推荐文章于 2023-07-11 10:59:18 发布