2

Is there a way to reference a Java runtime parameter (e.g. -Dfoo=bar) in a servlet container's web.xml? E.g., in a Spring context config, I can do systemProperties['foo']}. Can I do something similar in web.xml?

In case you're curious, I am trying to parameterize the security level:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        classpath*:context*.xml
        classpath*:security-${sec.level}.xml
    </param-value>
</context-param>

So that either security-high.xml or security-low.xml can be used depending on the parameter set when launching the server's java command. I'm currently do resource filtering in Maven when I build my war but that makes a war with a fixed security setting. I would like it to be contingent on the runtime environment.

amphibient
  • 29,770
  • 54
  • 146
  • 240
  • 1
    https://stackoverflow.com/questions/1404384/referencing-environment-variables-in-web-xml – Ivan Jan 10 '18 at 22:01

0 Answers0