问题描述
在修改用户定义的Servlet类时,我们需要重新启动Apache Tomcat服务器.但是,只要我们修改JSP文件,就不需要重新启动.
While we modify a user-defined Servlet class, we need to Restart the Apache Tomcat Server.but Whenever we modify a JSP file, we need NOT Restart.
请任何人告诉我其背后的确切原因.
Please anyone tell me the exact reason behind that..
谢谢.
推荐答案
这是因为Tomcat不支持热代码替换.如果您正在像Eclipse这样的IDE中进行开发,则可以使用 JRebel 插件实现这一目标.截至目前(2019年5月),JRebel仍然没有免费的替代品(主要是因为这确实是不平凡的).
It's because Tomcat doesn't support hot code replacement. If you're developing in an IDE like Eclipse, then you could use among others the JRebel plugin to achieve this. As of now (May 2019), JRebel has still no free alternatives (primarily because this is really non-trivial).
但是有些服务器支持开箱即用的热代码替换,例如 WildFly 和 Payara .对于它们,当您编辑现有方法时,不需要JRebel.这些服务器开箱即用,能够通过JVM热插拔功能执行热代码替换.然后,仅当您要添加 new 类/方法并使它们立即部署时,才需要JRebel.
There are however servers which support hot code replacement out the box, such as WildFly and Payara. For them JRebel is not needed when you edit existing methods. These servers are out the box capable of performing hot code replacement via JVM hot-swap feature. JRebel is then only needed when you want to add new classes/methods and get them to deploy instantly.
这篇关于为什么每次编辑Servlet类时都需要重新启动Tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!