Properties处理两种行,自然行和逻辑行。
逻辑行:用反斜线在一行的末尾,会和相邻的下一行形成逻辑行,如下
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.apache.rocketmq.spring.autoconfigure.RocketMQAutoConfiguration自然行就是以\n or \r or \r\n结尾的。
key和值之间,用 '=', ':' 都可以。
下面三行是等效的
Truth = Beauty
Truth:Beauty
Truth :BeautyPropertyes 测试代码,读取test.log文件的内容,生成属性列表
public static void main(String[] args) throws IOException {
Properties properties = new Properties();
Reader in = new FileReader("test.log");
properties.load(in);
Collection<Object> values = properties.values();
System.out.println(values);
String b = properties.getProperty("b");
System.out.println(b);
}https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Properties.html










