Springboot热部署,搭配freemarker,完整方式

一、导入maven配置(加入以下两点)



   org.springframework.boot
   spring-boot-devtools
   true

   
      
         org.springframework.boot
         spring-boot-maven-plugin
         
         
            true
         
      
   

二、application.yml加入配置

spring:
  devtools:
   restart: #开启热部署
     enabled: true
     additional-paths: src/main/java
  freemarker:
    request-context-attribute: req #req访问request
    suffix: .html
    content-type: text/html
    enabled: true
    cache: false #缓存配置
    template-loader-path: classpath:/templates/ #模板加载路径 按需配置
    charset: UTF-8 #编码格式
    settings:
     number_format:  0.##   #数字格式化,无小数点

三、设置idea自动部署

File-》Setting-》Compiler-Build Project automatically  打上勾

Springboot热部署,搭配freemarker,完整方式_第1张图片

ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running

修改类会重启,修改页面会重启,如果遇到修改页面不会重启的话,修改完按Ctrl F9,自动部署=-=。

 

你可能感兴趣的:(springboot)