首先在pom.xml中引入依赖
接下来进行设置,设置方式有两种:
一.设置Edit Configurations
On update action: 选择Update classes and resources 或者hot swap classes and update trigger file if failed都可以。
有人说这种方式只能在debug模式下生效,其实run模式下一样有效。两者的区别是在改动java语句之后,在没有按Ctrl+F10的情况下,debug模式刷新浏览器会出现弹窗提示是否重新加载class文件,如下图:
所以选择run模式千万别忘了Ctrl+F10,没有提示的。
二.设置自动编译
先在Setting中Compiler选项中勾选build project automatically。
再通过ctrl + shift +alt + / 快捷键打开Registry,勾选compiler.automake.allow.when.app.running。
这种方法不用按Ctrl+F10。