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文件了。
参考博文: