• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

best place to put configuration properties.

 
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
where should i keep connection properties like hostName, and other properties for database conneciton, which i dont want to hard code(conneciton name & connection class). ???

Which is the best place for tham... so that in future if any modification requires than we can edit those properties without touching other code.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well if you have a JNDI context to go with you can use that to store runtime values.

You can also go with a properties files (just a flat file with some name value pairs) and I would recommend that you make them available outside your .WAR file.

You can choose init parameters or context parameters also
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would have used a application.properties file with the properties in the form of key value pair and put that in the /WEB-INF/classes folder .In the application load that property file in the property object and make use of the values.
 
Jigar Naik
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
allright...

I've set those parameters in .properties file but its in the war file.

How can i make it available outside the war file ? because there are some parameters which will get changed at regular interval.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess you are using war format for distributing/deploying.each time you change the property file , you have to replace the old property file and then make and new war and deploy it again.
 
Jigar Naik
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, that is what my TL dont want to do.

Is there any other way i can put .properties file out side the war file and access it. ??
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jigar Naik:
yes, that is what my TL dont want to do.

Is there any other way i can put .properties file out side the war file and access it. ??



TL - team lead. (always use expanded version of your vocabulary)

Two things you can do.

1> instead of making the way again and again , put the property file in the exploded war , which is there inside the server.and restart the server each time you change the property file.

2> make a build file that would make your job easy .replace property , make war , deploy ,restart server.
 
Jigar Naik
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
" make a build file "

Did not get it. Can you please explain it in more detail ?
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
make a ant build file to do the task.
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jigar Naik:
Can you please explain it in more detail



Refer this to create build file
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic