IntelliJ IDEA最新版配置SpringBoot热部署遇到的坑
前言
因为最近上课一直在学SpringBoot,但是老师用的是idea2019,我是2022,于是在配置热部署的时候遇到了不少坑,下面给大家介绍一下差异点,以免入坑
pom.xml
使用SpringBoot热部署,需要在pom.xml引入dev-tool的启动器
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
然后配置插件,需要在spring-boot-maven-plugin插件中配置参数
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
Edit Configurations
由于2022(2021也是)版本会自动折叠配置项,搞得我找了好久才找到,在箭头指向的地方选择Modify options,选择On 'Update' action
以及On frame deactivated
都修改成Update classes and resources
,这里很重要,考试会考的
automake
打开settings里面找到截图中的位置,File->Settings->Build,Execution,Deployment->Compiler,勾选build project automatically
敲黑板,duang duang duang
然后就是最重要的一个地方,我当时找了好久都没有找到这个地方,旧版本中需要Ctrl+Shift+Alt+/,然后选择registry,勾选compiler.automake.allow.when.app.running
,但是如果能轻易找到的话,我写这篇文章干嘛,新版本的配置以及改到了settings里面,Advanced Settings,勾选Allow auto-make to start even if developed application is currently running
大功告成
这样SpringBoot就可以自动热部署了,效果还不错,但是个人感觉速度有点慢,大概得等三十多秒左右。 于是我又找到了解决办法,还是在settings里面,Languages & Frameworks->Spring->Spring Boot里面找到找到我圈起来的地方,修改的越小,热部署的速度越快,我改成1之后基本上等个两三秒就可以热部署成功了
如无特殊说明《IntelliJ IDEA最新版配置SpringBoot热部署遇到的坑》为博主MoLeft原创,转载请注明原文链接为:https://moleft.cn/post-229.html
相关文章
- SpringBoot框架_skynet框架详解
- springboot类型参数解析图
- 【IDEA】idea设置默认maven配置, 避免每次设置maven「建议收藏」
- springboot上传文件大小配置
- IDEA SpringBoot整合Mybatis实现增删改查操作
- SpringBoot 之 Web 使用 Thymeleaf 模板
- idea springboot项目搭建_idea社区版配置Tomcat
- 用idea搭建springboot项目_springboot入门项目
- idea 快速搭建SpringBoot项目「建议收藏」
- SpringBoot整合thymeleaf
- SpringBoot日志源码解析:日志监听器的注册方法及触发
- 【SpringBoot】25、SpringBoot中使用Quartz管理定时任务
- IDEA 如何快速创建 Springboot 项目[通俗易懂]
- springboot多环境配置文件_Springboot教程
- springboot到底是什么_Springboot注解
- idea程序包org不存在-IDEA 程序包不存在
- SpringBoot AOP的execution 表达式详解
- springboot整合docker部署(两种构建Docker镜像方式)详解编程语言
- springboot 配置热部署详解编程语言