Scenario - The same application "App" was installed in two contexts: www.company.com.br/AppProd and www.company.com.br/AppTest
- Each one has an app.properties file that contains its database configuration (url, user, password, etc).
- Each one has a separated Apache HTTP Server and 2 Tomcat for load balancing.
- Base technologies: Apache, Tomcat, Spring and Java
Problem: We would like to keep the user changes (in the app.properties file) even if a new App is released and deployed.
Where/how should I put, link and load the app.properties in the source code/directory of the application?
Possible Solution (just a idea, not yet implemented):
Put each app.properties in the apache configuration directory, for example, apache1/conf/app.properties and apache2/conf/app.properties. Using this, we can redeploy a new version without overwrite the app.properties file, instead of to put this file (packed in the .war file) in the tomcat webapps directory.
I've read about PropertyPlaceholderConfigurer, but how to use this Class in my scenario?
This is not a certification question, so it does not belong in the certification forums.
I've been trying to decide where to move this to - normally I would handle this as a basic servlet / container issue. Using something like the ServletConfig you could store the database configuration on the Tomcat server, and this would be readable at the time the servlet starts up.
However since you have asked about Spring in particular, the people in the Spring forum may have other solutions. So I am moving this to the Spring forum.
Can I use JNDI and DataSource to solve my problem?
For example, If I started my application using the following link http//10.0.0.1/app_test -> get the dataSource from jdbc/app_test, else, if I started my application using the following link http//10.0.0.1/app_prod -> get the dataSource from jdbc/app_prod
Is this possible?
subject: Architecture problem: How to manage property files to the following scenario...