版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/liu689118/article/details/78960447
springboot的热部署常用的两种方法
- 使用 Spring Loaded
- 使用 spring-boot-devtools
一。
springloaded
在 POM 文件中添加依赖
添加完毕,启动项目
二. spring-boot-devtools
在POM文件加上jar
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration>
</plugin>
</plugins>
</build>
引入这两个后,热部署的还有两个方法:
1.加上JRebel,选定springboot,添加JRebel功能,此时为我们添加了一个rebel.xml,用来配置热部署内容
2. 在
application.yml配置文件中添加:
spring:
devtools:
restart:
#热部署生效
enabled: true
#设置重启的目录
#additional-paths: src/main/java
#classpath目录下的WEB-INF文件夹内容修改不重启
exclude: WEB-INF/**
设置WEB-INF下的jsp修改不需要重启