springboot 热部署

作用:不重启服务器编译/部署项目

1. 添加依赖

<!-- 热部署 -->
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>

2. 修改pom.xml配置  (添加configuration  )

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                <fork>true</fork>
                </configuration>
            </plugin>
        </plugins>
</build>

3. 重启服务

4. 便捷取消热部署

  在main方法中添加

//此设置一定要在SpringApplication.run(DemoApplication.class, args); 前面进行设置
System.setProperty("spring.devtools.restart.enabled","false");
原文地址:https://www.cnblogs.com/dztHome/p/10291679.html