Java/Language
[java] .properties 키-값 구분자 '=' vs ':'
허니몬
2017. 8. 14. 16:49
어느 책을 보다가 .properties 파일에 구분자로 = 대신 : 를 기재한 것을 보고
라고 생각하고 열심히 찾아봤다. 그런데 java.util.Properties#load메서드를 찾아보니 = 와 : 가 사용가능하다고 나와있다.
The key contains all of the characters in the line starting with the first non-white space character and up to, but not including, the first unescaped '=', ':', or white space character other than a line terminator. All of these key termination characters may be included in the key by escaping them with a preceding backslash character; for example,
|
키에 대한 값으로 :, = 또는 공백문자가 아닌 첫번째 문자부터 시작하여 줄의 끝까지 값으로 포함된다.
그러나, 관례라고 하긴 그렇지만 넓게 사용되는 것은
.propertiesserver.port=9090app.info.name=honeymonapp.info.ver=v1.0
.ymlserver.port: 9090app.info:name: honeymonver: v1.0
가 아닐까 생각한다. 그냥 문득…