Environment/system variables in server.xml

后端 未结 2 799
庸人自扰
庸人自扰 2020-12-05 19:31

How can I use environment/system variables in tomcat server.xml, context.xml, etc configuration files?

I tried to use ${ENV_VAR_NAME} (both for environm

2条回答
  •  醉酒成梦
    2020-12-05 20:28

    Environment variables can be referenced in the server.xml etc by setting the system property org.apache.tomcat.util.digester.PROPERTY_SOURCE to the value org.apache.tomcat.util.digester.Digester$EnvironmentPropertySource.

    That system property has been available since 7.0, but EnvironmentPropertySource was not mentioned in the doc until 8.5.

    https://tomcat.apache.org/tomcat-9.0-doc/config/systemprops.html

    Update (April 2020):

    The latest tomcat releases (9.0.34, 8.5.54) now support property replacement in most configuration files: https://tomcat.apache.org/tomcat-9.0-doc/changelog.html#Tomcat_9.0.34_(markt)

提交回复
热议问题