I'm deploying two spring servlets in a shared tomcat environment. I'd like to be able to run each application with its own command line args. An example would be, I want to run each one with a different spring profile active. I know I can set an environment variable in setenv.sh, but I want to make this dynamic. I had thought I could do an if/else in the catalina.sh, if the app name is X then set args accordingly. Could I use an environment variable which my application picks up & set the profile from here? Does anyone know how this could be achieved? I don't want to change the build of the application, and I don't want to make global changes that would impact other applications in this shared tomcat server.
I have tried setting an if/else in catalina.sh where the JAVA_OPTS are being set, but this isnt set for each application, rather it's set globally. I want to be able to change where the war is automatically deployed from.