SpringBoot热部署
1、使用SpringLoader进行热部署
方式一:maven插件
在pom.xml中添加插件
<!-- springloader插件 -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.5.RELEASE</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
注:使用maven命令启动:spring-boot:run
缺陷:只能对java代码作部署,对页面无能为力。
而且是在系统后台以进程的形式进行,需要手动关闭该进程
方式二: 在项目中直接使用jar包
将 springloaded-jar包放入lib文件夹中即可,(不用手动关闭)
启动时选择Run Configurations
2、DevTools工具
springloader:热部署
devtools:重新部署
修改pom.xml
<dependencies>
<!-- SpringBoot启动器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- thymeleaf启动器的坐标 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- devtools坐标 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> 不向下传递该依赖
</dependency>
</dependencies>
完工!!!(调试项目很方便)