tomcat的热部署和热加载

本文介绍了Tomcat的热部署和热加载特性,包括`reloadable`和`autoDeploy`两个关键配置。`reloadable="true"`会导致Tomcat在`/WEB-INF/classes/`或`/WEB-INF/lib`发生变化时重新加载整个web应用,适合开发阶段但不推荐用于生产环境。而`autoDeploy="true"`使得Tomcat能自动检测并部署新的或更新的web应用程序,无需重启。
摘要由CSDN通过智能技术生成

最近接触的项目在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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值