版本:IntelliJ IDEA 2017.3.4
系统:Windows
eclipse中配置依赖即可实现热部署但IDEA不能,需做一些配置
step1
在pom中添加spring-boot-devtools依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
step2
Settings->build,execution,deployment->compiler选项中 , build project automatically勾选上:
step3
快捷键 ctrl + alt + shift + / ,进入Register:
在Register界面中把compiler.automake.allow.when.app.running选项勾选上:
tips
如果还不行,在pom文件中加上如下配置:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>//该配置必须
</configuration>
</plugin>
</plugins>
</build>
欢迎指正