IDEA2022版本设置热部署
-
开启IDEA的自动(静态)编译
具体步骤:打开顶部工具栏 File -> Settings -> Build,Execution,Deployment -> Compiler 然后勾选 Build project automatically
-
开启IDEA的自动(动态)编译
具体步骤:打开顶部工具栏 File -> Settings -> Advanced Settings -> Compiler -> 然后勾选 Allow auto-make to start even if developed application is currently running
-
开启IDEA的热部署策略(非常重要)
具体步骤:点击Edit Configurations…进入
选择Modif options -> On ‘Updata’ actrion -> Update classes and resources
-
在pom.xml文件中导入热部署插件
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> </dependency> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork><!--必须添加这个配置--> <addResources>true</addResources> <excludes> <exclude> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </exclude> </excludes> </configuration> </plugin>