开发者

placing properties in database instead of property file

Java, is placing and loading properties from database instead of property file is better a开发者_高级运维pproach ?


Advantages if you place it in DB.

  • It can be centrally shared.
  • If you want to retrieve particular key you don't need to load whole data you can uniquely obtain value from key.
  • DBMS is always reliable then File IO.

Advantages of Properties file :

  • if data size is smaller then storing it in properties file would be beneficial.


It really depends. But in generic cases:

Use a PropertiesFile when:

  • Those properties are needed to connect to the database.
  • When there is no database involved

Use a Database Table when:

  • Database states could change the values
  • When your application uses a database
  • You need the flexibility of different properties depending on the database that is connected to.

In all other cases, the decision is on the fence and it doesn't really matter which way you go.


It all depends is probably the correct answer here.

Our solution:

All our products to first check -D command-line (when building), then PATH, then the Configuration-directory set up on our local machines, and finally default to the data base.

ie. For production and system-test we load properties from the database, for everything up to that point we override with property-files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜