Naming convention for properties in property file

后端 未结 7 1465
感情败类
感情败类 2021-02-03 20:05

What are the naming conventions for property names defined in properties files in Java? Can I use uppercase or only lowercase?

For example: bankAccountNumber or bank.acc

7条回答
  •  轮回少年
    2021-02-03 20:39

    There is no standard convention for naming properties in property file.

    Ref: https://en.wikipedia.org/wiki/.properties

    As you are Java user, you can use camelCase.

    For the given example, the name can be bankAccountNumber.

    In case, if the requirement is to follow the hierarchy structure, dots can be used as below.

    • bank
    • bank.account.name
    • bank.account.number
    • bank.department.name

提交回复
热议问题