怎样让Tomcat告别频繁重启?

  在网站开发过程中,有一个很烦的问题就是每次我们在项目里增加几行代码,然后我们企图在浏览器中查看修改后的变化时,却发现浏览器的内容并不变化,于是我们只能通过频繁的重启tomcat来获得最新的效果,其实这么做完全没必要,我们只需要修改下tomcat目录下conf文件夹中的context.xml中增加reloadable="true"就可以获得重启的效果。

  具体修改的配置如下:

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2.   
  3. <!-- The contents of this file will be loaded for each web application -->  
  4.   
  5. <!-- 在此处添加reloadable="true"即可 -->  
  6. -<Context reloadable="true">  
  7. <!-- Default set of monitored resources -->  
  8.  <WatchedResource>WEB-INF/web.xml</WatchedResource>  
  9. <!-- Uncomment this to disable session persistence across Tomcat restarts -->  
  10.    
  11. <!-- <Manager pathname="" /> -->  
  12.    
  13. <!-- Uncomment this to enable Comet connection tacking (provides events on session expiration as well as webapp lifecycle) -->  
  14.    
  15. <!-- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> -->  
  16.  </Context>
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/lsxs-wy/p/6825129.html