天天看点

Idea配置SpringBoot热部署Idea配置SpringBoot热部署

Idea配置SpringBoot热部署

文章目录

  • Idea配置SpringBoot热部署
    • 引入依赖
    • 设置自动编译
    • 允许自动启动

引入依赖

pom.xml

文件引入支持SpringBoot热部署的依赖:

<!-- spring-boot-devtools热启动依赖包 start-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
    <scope>true</scope>
</dependency>
<!-- spring-boot-devtools热启动依赖包 end-->
           

设置自动编译

File

——>

Settings

——>

Build,Execution,Deployment

——>

Compiler

勾选

Build project automatically

,面板右下角

Apply

——>

OK

Idea配置SpringBoot热部署Idea配置SpringBoot热部署

允许自动启动

使用快捷键

Ctrl + Shift + A

打开Idea设置查找,输入

Registry

打开注册表设置。勾选

compiler.automake.allow.when.app.running

选项,然后关闭即可。

Idea配置SpringBoot热部署Idea配置SpringBoot热部署

提示信息是说:允许自动启动,即使开发的应用程序当前正在运行。请注意,自动启动的情况下可能最终会删除应用程序所需的某些类。

然后尝试修改一下代码,保存更改,即可看到项目热部署生效。

继续阅读