Home > database >  Where to put deployment specific properties in Java
Where to put deployment specific properties in Java

Time:11-10

For building web applications in Java, I have Tomcat as the integrated server in Eclipse for development. Some of the target systems are using JBoss while others are using WebLogic 12C.

Application related settings are kept in app.properties file and loaded at runtime. Same as given here .

Where should I keep deployment specific properties? i.e. I want to keep items such as "Site Title", "Company Name", "Database User", blah blah which would be different for each deployment. As an example, if I deploy the same app for two customers, I should be able to change the "Company Name".

When using .properties files, I'd have to keep separate branches of the same code and recompile for each deployment.

What is the recommended pratice/method for doing so?

CodePudding user response:

If this is an application that will support a build tool like maven then you could use maven to configure multiple profiles for the multiple companies and keep that information in properties files for example application-compA.properties, application-compB.properties etc. So when you build you will build for compA compB etc.

CodePudding user response:

In JBoss you have the overlay option: create an overlay of your deployment with your specifics. https://access.redhat.com/solutions/383393 I don't know about Weblogic. Otherwise as @BuffChuck wrote, you need to manage that at the build level.

  • Related