今天部署项目时,重启完之后,发现web.xml文件少增加了一个配置,加上之后,发现web.xml文件增加的配置立即生效了。感觉很奇怪,这个文件应该不是热部署的才对,于是乎上网寻求答案:
发现有一种说法是Tomcat的Content.xml文件中有配置可以监听web.xml文件,如果有修改会重启Tomcat。
配置如下:
<Context>
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
</Context>
后经过查询确认Tomcat中存在此配置,解除了疑问。