Best way to read properties file in java?

后端 未结 3 819
遇见更好的自我
遇见更好的自我 2020-12-10 09:18

I am aware of two ways to read a .properties file:

1- System.getProperties.load(Inputstream for .properties file);

2- Creating a new Properties object and

3条回答
  •  感动是毒
    2020-12-10 09:23

    Depends on what the properties file represents. If it represents system properties which needs to override/supply some default system properties, then go for the first approach. But if it represents application-specific properties (which is more often the usual case), then go for the second approach.

提交回复
热议问题