1、使用Thymepleaf模板需要設置spring.thymeleaf.cache:false,在配置文件中把Thymeleaf模板的緩存關閉
2、設置熱部署
①
<!--熱部署模塊-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.6.RELEASE</version>
<configuration>
<!--fork: 如果沒有該項配置,肯呢個devtools不會起作用,即應用不會restart-->
<fork>true</fork>
</configuration>
<executions>
<execution>
<goals>
<!-- 用於打包jar -->
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
②在IDEA中 按下 Ctrl+Shift+Alt+/ 四鍵,選第一項
將藍色的那一欄後面的選項框打上勾
③在settings裏找到Build,Execution,Deployment中的Compiler, 再找到BuildProjectAutomatically打上勾
熱部署就生效了。
但是在我的項目中,熱部署生效了一段時間,又不能用了,由於我項目中的web模塊每次重啓都需要兩分鐘以上,所以我必須解決這個問題,如果修改一次html或者js文件就需要花兩分多鐘來看結果。。那可想而知。。開發速度會慢到什麼樣的程度。
打開settings,找到Plugins然後下載liveEdit插件後重啓IDEA,又可以直接更新html和js文件了。
參考博文: