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


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