springboot+maven+devtools热部署

1.添加依赖坐标

<!-- spring boot devtools 依赖包. -->

<dependency>

       <groupId>org.springframework.boot</groupId>

      <artifactId>spring-boot-devtools</artifactId>

     <optional>true</optional>

     <scope>true</scope>

</dependency>

2.添加插件

<build>

   <plugins>

       <!-- 这是spring boot devtool plugin -->

        <plugin>

           <groupId>org.springframework.boot</groupId>

          <artifactId>spring-boot-maven-plugin</artifactId>

           <configuration>

           <!--fork : 如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart -->

              <fork>true</fork>

             </configuration>

        </plugin>

    </plugins>

</build>

3.更改idea配置

3.1  “File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,选中打勾 “Build project automatically” 。

3.2 组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry”,选中打勾“compiler.automake.allow.when.app.running”.

4.chrome禁止缓存

F12或者“Ctrl+Shift+I”,打开开发者工具,“Network” 选项卡下 选中打勾 “Disable Cache(while DevTools is open)”

猜你喜欢

转载自blog.csdn.net/weixin_40333020/article/details/88736709