tomcat的热部署和热加载

最近接触的项目在tomcat启动时特别慢,启动将近花十分钟,在开发的过程中,出现一个java文件修正,tomcat就重新启动一次,实在无法忍受,上网查了一下tomcat的热部署和热加载,才知道是由于【reloadable="true"】导致的。


下面是关于reloadable的解释,如果【/WEB-INF/classes/】或者/WEB-INF/lib 下面有变化,tomcat会重新加载整个web应用。

reloadable:Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.


下面是关于autoDeploy的解释,当context XML改变的时候,会直接部署到tomcat上,而不用重启tomcat。假设tomcat下面多加了一个应用,tomcat会自动部署这个应用,不用重新启动。

autoDeploy:This flag value indicates if Tomcat should check periodically for new or updated web applications while Tomcat is running. If true, Tomcat periodically checks the appBase and xmlBase directories and deploys any new web applications or context XML descriptors found. Updated web applications or context XML descriptors will trigger a reload of the web application. The flag's value defaults to true. See Automatic Application Deployment for more information.


以上都是自己的理解,有不足或者错误请指出,谢谢!


参考资料:

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

http://tomcat.apache.org/tomcat-7.0-doc/config/host.html


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章