1、pom.xml文件中添加
       <!-- 热部署开发工具 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>
2、preference->Build,Execution,Deployment->Compiler 打开里面的: Build project automatically

3、开启项目运行时自动生成
ctrl + shift + a(windows系统),
command+shift+alt+/(mac系统)
搜索命令:registry => 勾选compiler.automake.allow.when.app.running


最后 关闭IDEA重启,才能生效
完
原文:https://www.cnblogs.com/xuchen0117/p/14389187.html