using properties file in spring java mvc along with xml files

HI,
I have a spring java project i found that its using two files :
1) database.xml
2) database.properties

The database.properties file specify the jdbc url and username and password
These properties are then used in database.xml file with the notation "${}" to access the jdbc url and username and password

My question is why create the database.properties file in the first place ? arent xml files also non compiled and so one can directly edit them without restarting the server ?
Is it just for a readability purpose or there are some other significance of using this pattern ?
Rohit BajajAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

srikoteshCommented:
yes u r correct
if we use database. properties we can do modifications if required with out disturbing the application,no need to restart the server.
if we use directly database. xml with out using database.properties file
we need to restart the server,if any modification required.
0
Rohit BajajAuthor Commented:
what is the exact reason.
1) why server restart is not required when changing properties file?
2) why it is required when xml is changed ?
i have read somewhere that there are hot deployment ways. like using jrebel etc which automatically handles any change....i think using that does not require server restart
0
srikoteshCommented:
properties file no need to compile
where as xml we need to recompile and restart the server.
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
I think it is more just for readability. It is much easier to look at what is probably only a couple of lines in the .properties file than to sift through maybe 10's or 100's of lines in the .xml file. Also it is much easier to create big problems by incorrectly editing the .xml file than it is if you botched up the .properties file. And another issue that I can think of, is that there are more special, interpreted characters in XML. Just one that I can think of that would be common in a DB URL is the & character. If this were directly in the .xml file, the person editing would have to remember to use the full XML character entity like this... & to make the XML parser happy, where as if it is in the .properties file you can just use & directly.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mccarlIT Business Systems Analyst / Software DeveloperCommented:
As to what support the application has for HOT changes to those setting, it is still a case-by-case basis. As you have it now, where those properties are used by the XML with ${} placeholders, without further external support you STILL need to restart the server for any changes to those DB parameters.

However, there are other cases where you CAN easily support HOT changes to .properties file without needing server restarts, and you could do this easier than having the changes applied to the .xml file.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.