因为最近上课一直在学SpringBoot,但是老师用的是idea2019,我是2022,于是在配置热部署的时候遇到了不少坑,下面给大家介绍一下差异点,以免入坑
使用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>
由于2022(2021也是)版本会自动折叠配置项,搞得我找了好久才找到,在箭头指向的地方选择Modify options,选择On 'Update' action
以及On frame deactivated
都修改成Update classes and resources
,这里很重要,考试会考的
打开settings里面找到截图中的位置,File->Settings->Build,Execution,Deployment->Compiler,勾选build project automatically
然后就是最重要的一个地方,我当时找了好久都没有找到这个地方,旧版本中需要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
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有