public class Test {
public static void main(String[] args) throws IOException {
Properties properties = new Properties();
// FileReader reader = new FileReader("./test.properties");
// FileReader reader = new FileReader("test.properties");
FileReader reader = new FileReader("G:\\springboot-mybatis\\test.properties");
properties.load(reader);
System.out.println(properties.getProperty("name"));
}
}
三种获取路径的方式
最新推荐文章于 2022-08-01 19:10:00 发布
该博客展示了如何在Java中使用Properties类从`G:springboot-mybatis est.properties`路径加载配置文件,并获取键为'name'的属性值。这是一个基本的Java IO操作,对于理解和处理应用配置文件至关重要。
172万+

被折叠的 条评论
为什么被折叠?



