目前,我的 server.xml 中有:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
我希望它变成:
<Connector port="${oms.ui.port}" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
我将此属性 oms.ui.port 放在驻留在 apache-tomcat-7.0.8\lib 中的属性文件中 但它没有找到它,我得到:
WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'port' to '${oms.ui.port}' did not find a matching property.
也许有更好的 Tomcat 经验的人可以帮助我,好吗?
最佳答案
根据 Tomcat 7.0 Configuration Overview :
Apache Ant-style variable substitution is supported; a system property with the name propname may be used in a configuration file using the syntax ${propname}. All system properties are available including those set using the -D syntax, those automatically made available by the JVM and those configured in the $CATALINA_BASE/conf/catalina.properties file.
因此,您可以使用 JVM 系统属性或 catalina.properties
来声明您的变量并为其赋值。
关于Tomcat - 如何指定可以在 server.xml 中扩展的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8254543/