Is it bad practice to include properties/configuaration files within jars?

前端 未结 11 989
谎友^
谎友^ 2021-02-07 00:34

For example:

MyApp is a web app that contains a properties file (server.properties) that describes config data (e.g. server names) for the app. In the development phase

11条回答
  •  北荒
    北荒 (楼主)
    2021-02-07 00:59

    It depends. If the properties file contains data that is intended to be changed by the user of your application or library, than it should reside outside.

    If it contains data that is static and you created the properties files just to avoid coding the values in the sourcecode or if the files are localized strings, I'd leave them in the jar. At least because a properties file invites people to change values ;)

提交回复
热议问题