1、springboot版本:2.1.1
2、idea版本:2019
3、操作步骤:
pom.xml增加配置:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <scope>true</scope> </dependency>
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <!--by add 361375 2019/7/13 热部署配置--> <configuration> <!--fork : 如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart --> <fork>true</fork> </configuration> </plugin>
application.yml配置:
spring devtools: restart: enabled: true additional-paths: src/main/java
idea配置:
自动:
1)File -> Settings -> Compiler,勾选 Build Project automatically
2)按快捷键Ctrl+Shift+Alt+/,选择1.Registry...
3)勾选 compiler.automake.allow.when.app.running 即可