Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Loading Configuration files  RSS feed

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to use config files in my application. My requirement is roughly as follows:

I have different properties that have different values in different environments
I would like my properties file to be an xml
I would prefer to use the same deployable in all environments with no modifications.

My plan is as follows:
Use apache commons configuration (xml)
Define separate configuration files for different environments(Dev, Qa, Prod)
Identify the environment to use using a JVM argument.

My question is:
What is the standard way of loading the configuration file? Have a singleton class that loads the config file and that has a get method?






 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cindy,

I have used a singleton like you suggested in the past and it works quite well. That should be as good an approach as any.

Jeff
 
Good night. Drive safely. Here's a tiny ad for the road:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!