Is there a way to enable system properties in the web.xml file?

I added a system property to my run.conf of my JBOSS as follows:

JAVA_OPTS="$JAVA_OPTS -Dfoo=bar"

My question now is whether there is a way to resolve this property in the web.xml file like this:

...
<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>
    classpath:applicationContext-common.xml
    classpath:conf/${foo}/applicationContext-local.xml
  </param-value>
</context-param>
...
+3
source share
4 answers

I do not know any possibility. But, in my opinion, this should be implemented in the application. Why do you want to increase indirection? Normally, you access the contents of web.xml from your application (app> web.xml). Why is this: app> web.xml> environment variable?

0
source

JBoss web- tomcat, ($ {foo}/applicationContext-local.xml). JBoss, Tomcat.

+3

You need to set spec-descriptor-property-replacement in standalone.xml to true

    <subsystem xmlns="urn:jboss:domain:ee:1.2">
        <spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>
        <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
    </subsystem>
+2
source

web.xml should be applied to only one web application. It must not have a global configuration. So no. In any case, by the time the server and your webapp booted up, it started late to start playing command line arguments.

+1
source

Source: https://habr.com/ru/post/1705424/


All Articles