Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to store web application's configuration variables?

Why would you not store web application's configuration variables simply in a class file?

I need to store variables like as how many product items to show in one page at a time. Where should I store them as such that my Java classes can use them? What is the standard for this?

like image 707
Rajat Gupta Avatar asked Dec 05 '25 01:12

Rajat Gupta


1 Answers

Why would you not store web application's configuration variables simply in a class file?

That would require rebuilding, redeploying and restarting the whole beast whenever you make minor edits. It's maybe not painful if you're just locally hobbying. But in real world (when done rightly) you would need to get it through the whole chain of continuous build, automated testing, QA, etc. This makes no sense for a silly change in a configuration setting.

Your webapp must be designed that way that configuration can be changed externally and preferably also that it is able to reload configuration on demand (e.g. a button on an admin page) or even automatically (e.g. by @Schedule @Singleton). This way the serveradmin has just to edit a simple and self-documenting textbased file instead of waiting hours or even days to get it into production.

like image 84
BalusC Avatar answered Dec 07 '25 16:12

BalusC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!