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 即可