Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

property file dynamic vs static

 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May i know the property file or resource bundle we use in struts is dymic or static?
In otherwords, can we change value content in property file at runtime without having to restart the server or redeploy?
 
Joe Ess
Bartender
Posts: 9279
10
Linux Mac OS X Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Static.
 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Ess wrote:Static.


So if i want to change a button name from "X", which is comming from property file(resource bundle), to "Y". should I restart the server after making changes to value in property file?
 
Joe Ess
Bartender
Posts: 9279
10
Linux Mac OS X Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't have to restart the server, you have to redeploy your WAR or EAR.
Most servers can detect changes made to files and automatically redeploy. This is a convenience for development purposes. Not for production use.
 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Ess wrote:You don't have to restart the server, you have to redeploy your WAR or EAR.
Most servers can detect changes made to files and automatically redeploy. This is a convenience for development purposes. Not for production use.


May I know how property file get affected at the below mentioned time


compile
run
deploy
publish

want to make changes in the producation but dont want to stop, restart or recompile the server in order to avoid creating any problem to users who are using the web site.


Note: My plan is to make changes to the web site that is being used by across the world by thouseds of users. And the change is-- changing the button name from X to Y, and the button name X is to be changed in the property file only to Y.
 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can place you property file on any external location excluded from the application ..


so any changes done in property file does not need any Server start or even redeploy..


Regards ,
Raza
 
Joe Ess
Bartender
Posts: 9279
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raza Mohd wrote:you can place you property file on any external location excluded from the application ..
so any changes done in property file does not need any Server start or even redeploy..


Property files don't automatically reload after a change, so you will still need a mechanism to detect changes and update the in-memory copy. Have a look at Apache Commons Configuration.
 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tested it with placing the property file on my hard drive and accessing it from the application..
So when i made any changes in property file, the changed Data was fetched by the Application .. it Does not require any Server resart or redeploy ..

I just checked it on my local machine....

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic