spring-boot热加载

spring-boot热加载


  • 只要在pom文件中添加下面代码段即可
<!-- 热部署 -->
    <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>
        <configuration>
          <!-- 没有该配置,devtools 不生效 -->
          <fork>true</fork>
          <addResources>true</addResources>
        </configuration>
      </plugin>
    </plugins>
  </build>

但是配置好无效,下面需要修改idea中的两个配置

  • setting –> compiler
    将 Build project automatically 勾选上
  • alt + shift + a 搜索 registry 选第一个,弹出框后下拉找到 compiler.automake.allow.when.app.running 勾选上即可。

热部署无效问题已解决。

转自:https://blog.csdn.net/android_ztz/article/details/79221753

猜你喜欢

转载自blog.csdn.net/u012661496/article/details/82291081