tomcat7 - Java web app: Tomcat and configuration files .properties -


I have a Java web app with Thomas, which is in the form of a sublet container.

I want to use different configuration files for different build configurations, i.e.

1) demo. Properties

2) real.properties

3) test.properties

In which I want to specify the database name, DB user and password (Now for DB I use JnDi Resource Configuration in AP context.xml ), if I should be able to send mail or not (I now have two modes of content whose contents I have Whether to comment or not), some CSS image paths and some other stuff Do not.

If this is possible, how can I extract DB from connection to context.xml ? And if my app is a test or a demo, how can I stop sending emails?

Edit

Thank you for answering Anton Sheshnini, I was successful in extrapolating DB from context.xml Connection parameters (say in configApp.properties .)

configApp.properties should be in the Tomcat Lib folder. The interspace UT, which together with the class Imposes Property Assoccer.

So, how can I simplify this solution like it can be used for different web app deployment? (I prepare .war locally, then it is positioned on a remote server)


Comments