Win a copy of Microservices in Action this week in the Web Services 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Defining Params outside of ,war file  RSS feed

Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to define param outside my .war file. I would like to have different values in my param-values depending if the system is running in dev / test or prod.

I am currently defining params in my web.xml file. The web.xml file is compiled into my .war file.

Do you have any ideas on where I can define params outside of my .war file.
Thanks so much, Lisa
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lisa,

The best way is use a properties file(s), which contains all the dev, qa and production related configuration information. Send the jvm arguments from outside to tell which version of configuration you want to use(dev, qa or production). Create a helper class, which reads the configuration file as per jvm arguments and load it in JVM.

But, If you want to keep the properties file from outside the war file, remove it from your WEB-INF/classes directory and keep the properties file in class path(which is not a recommened way of doing it).

Hope it helps!!!

Anil Sadineni.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!