springboot+freemarker热部署

springboot+freemarker热部署

1.在pom文件中添加

<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>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
2、设置 freeemarker.cache=false

SPRING PROFILES

spring:
freemarker:
allow-request-override: false
allow-session-override: false
cache: false
charset: UTF-8
check-template-location: true
content-type: text/html
enabled: true
expose-request-attributes: false
expose-session-attributes: false
expose-spring-macro-helpers: true
prefer-file-system-access: true
suffix: .ftl
template-loader-path: classpath:/templates/
settings:
template_update_delay: 0
default_encoding: UTF-8
classic_compatible: true

3、修改IDEA的设置

打开 Settings –> Build-Execution-Deployment –> Compiler,将 Build project automatically.勾上。

4、点击 Help –> Find Action…,或使用快捷键 Ctrl+Shift+A来打开 Registry…,将其中的compiler.automake.allow.when.app.running勾上。

5、重启idea
完成上面的步骤就可以方便使用了。

见: http://www.qchcloud.cn/tn/article/24

猜你喜欢

转载自blog.51cto.com/14042154/2391300