SpringBoot2.X Devtools 热部署

pom文件引入所需jar包

springboot版本采用2.3.1

 <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <springboot.version>2.3.1.RELEASE</springboot.version>
  </properties>
  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      <version>${springboot.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <version>${springboot.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <version>${springboot.version}</version>
    </dependency>
<!--插件里面加入热部署插件-->
<build>
    <finalName>spring-boot-devtools</finalName>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
      <plugins>
       <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>${springboot.version}</version>
                    <configuration>
                        <fork>true</fork>
                    </configuration>
                </plugin>
      </plugins>
    </pluginManagement>
  </build>

启动设置成热部署

修改代码后点击刷新即可

控制台重新打印SpringBoot图标就可以了

posted @ 2020-08-16 16:15  余慕秦丿  阅读(257)  评论(0编辑  收藏  举报