1. Click tomcat settings in idea
2. Click deployment to see whether the package that tomcat runs every time in Deploy at the server startup is xxxx:war or something else. If it is an xxxx:war package, please replace it. Click the green plus sign next to it, select xxxx:war exploded, and then set xxxx :war Click on red to delete
3. Then select update classes and resources for "On Update action" and "On frame deactivation" in the server
4. You're done, it has been tested personally, and you don't need to restart every time you modify the code!