Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading Property files using Struts

 
Mohammed Yousuff
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i load the property files smartly using struts Framework.As per my project requirement, i like to load any of the 3 property files based on the environment (like development,QA and production environment).Please let me know how it can be achieved . Thanks in advance.
 
Santosh Ramachandrula
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I normally do it during the build process where I can specify the environment.

Other than this I am guessing that we will have to write some kind of logic with in application class loader that picks up the environment specific property file(You may have to bundle all the environment specific property files along with your jar/war/ear).

Would be interested in knowing if other alternatives can be used.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of my clients accomplished this using Java System properties (System.getProperty()). They set an Environment property for each of their environments (PROD, QA, Or DEV). The application logic would then look at this property and load the appropriate properties file.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of my clients accomplished this using Java System properties (System.getProperty()).


I remember seeing a similar thing, but instead of setting it as a System property, the env-entry in the web.xml was used for achieving the same.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic