web项目中加载properties文件的几种方法
工具/原料
Windows系统
web项目开发环境
方法/步骤
1、打开我们的项目properties文件在src文件夹下的情况下
2、通过getResourceAsStream读取properties文件
3、通过java.util.ResourceBundle读取资源属性文件
4、通过类加载目录getClassLoader()加载属性文件
5、通过FileInputStream读取properties文件
6、以上四种获取方法运行之后的输出结果都为下图所示
7、现在是写入properties文件使用的是FileOutputStream
8、运行java文件后你会看到修改前后userName的值发生了变化