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.