使用IDEA進行開發,使用freemarker做前端展現,但發現前端頁面修改后總是重新啟動才能刷新。
主要原因是IDEA的熱部署沒有成功啟動。熱部署主要有以下幾個地方,缺一不可:
1、在pom.xml中引用相應的依賴包。
1
2
3
4
5
|
<
dependency
>
<groupId>org.springframework.boot</groupId
>
<artifactId>spring-boot-devtools</artifactId
>
<optional>true</optional
>
<
/dependency
>
|
1
2
3
4
5
6
7
|
<
plugin
>
<groupId>org.springframework.boot</groupId
>
<artifactId>spring-boot-maven-plugin</artifactId
>
<configuration
>
<fork>true</fork
>
</configuration
>
<
/plugin
>
|
2、打開IDEA的自動編譯(IDEA缺省是關閉的):
Settings-> Build-Execution-Deployment –> Compiler,將 Build project automatically勾上。
3、打開運行時自動編譯:
通過Help->Find Action,來打開Registry……。將其中compiler.automake.allow.when.app.running勾上。
4、在項目配置中,指定禁用freemarker緩存,及0秒刷新延遲。
1
2
|
spring.freemarker.cache=false
spring.freemarker.settings.template_update_delay=0
|