idea+springboot+freemarker热部署(亲测)
需求:
最近要做前端事情,使用了idea+springboot+freemarker,每次修改freemarker都要重新启动,网络找了一些方法,加上自己的一些方法完成了。本人用的是idea2018.1的版本。备注:请使用google浏览器,火狐会有缓存
步鄹
第一步:在maven中加入devtools的依赖(这里我使用的是maven来管理项目)
<!-- freemarker热启动 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<build>
<plugins>
<!-- freemarker热启动 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
第二步:在application.properties中设置禁用模板引擎缓存
#freemarker热启动
spring.freemarker.cache=false
spring.freemarker.settings.template_update_delay=0
第三步:修改IDEA的设置
打开 Settings –> Build-Execution-Deployment –> Compiler,将 Build project automatically.勾上。
第四步:在Run/Debug Configurations中设置
全部设置完毕,重启一下IDEA。现在你就不必每次都手动的去点停止和启动了。
备注:请使用google浏览器,火狐会有缓存