There are a number of solutions, none of which are particularly clean or easy.
As indicated, changing web.xml will reload the context and therefore update the source code, and this can be done without restarting the server. This works because "WEB-INF / web.xml" is configured as WatchedResource in the TOMCAT / conf / Context.xml file. That is, each context inherits this parameter and automatically looks at this file. You can remove this behavior, but you can also provide WatchedResource values ββin your own web.xml to view additional files. Although I do not recommend it, you can add all your class files to this, and the context will reload when a single file changes.
A better solution depends on the class being reloaded when you drop the ClassLoader that loaded the class. Therefore, if you manage your hot-swappable code in your own ClassLoader, you can update your code without restarting the context if you update ClassLoader. Easier said than done, unfortunately, but you can start.
source share