Spring Boot热部署

2018-10-16  本文已影响14人  圈圈猫

Spring Boot热部署,每次修改文件或者是新增一个类后都会重新启动服务,这样就不需要自己重新的点击。

1、在工程下的pom.xml文件中添加配置

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <optional>true</optional>
      <scope>true</scope>
</dependency>
<build>
      <plugins>
          <plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
          </plugin>
          <plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
              <configuration>
                  <!-- 没有该配置,devtools 不生效 -->
                 <fork>true</fork>
              </configuration>
          </plugin>
      </plugins>
</build>

2、设置IDE

1、点击file----->setting
image.png
2、按快捷键“Shift+ctrl+alt+/”, 选择Registry,选中打勾 “compiler.automake.allow.when.app.running” 。
image.png
上一篇下一篇

猜你喜欢

热点阅读