idea+springboot+freemarker热部署

第一步:在maven中加入devtools的依赖(这里我使用的是maven来管理项目) 

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                    <!-- 该配置必须-->
                </configuration>
            </plugin>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
            <!-- optional=true,依赖不会传递,该项目依赖devtools;之后依赖myboot项目的项目如果想要使用devtools,需要重新引入 -->
        </dependency>

第二步:在application.properties中设置禁用模板引擎缓存

spring.freemarker.cache=false
spring.freemarker.settings.template_update_delay=0

第三步:修改IDEA的设置

  1. 打开 Settings –> Build-Execution-Deployment –> Compiler,将 Build project automatically.勾上。
  2. 点击 Help –> Find Action..,或使用快捷键 Ctrl+Shift+A来打开 Registry…,将其中的compiler.automake.allow.when.app.running勾上。   

    注:compiler.automake.allow.when.app.running 由于列表很长,不太好找。但是有个规律,他们是根据a、b、c字母进行排序的 ,根据这个规律仔细找就能找到了。

      

  3. 全部设置完毕,重启一下IDEA。现在你就不必每次都手动的去点停止和启动了
原文地址:https://www.cnblogs.com/shiyalong/p/8167817.html