1、pom天假devtools依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>false</optional>
<scope>true</scope>
</dependency>
2、編譯節點添加spring-boot-maven-plugin插件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
3、設置Idea開啓自動編譯項目
4、快捷鍵:Ctrl+Shift+Alt+ /
頁面熱部署
devtools可以實現頁面熱部署,即頁面修改後會立即生效。你可以在application.yml文件中配置
spring:
thymeleaf:
cache: false
來實現這個功能。