0
点赞
收藏
分享

微信扫一扫

SpringBoot学习-(十五)SpringBoot热部署


热部署

最重要的功能就是自动应用代码更改到最新的App上面去。原理是在发现代码有更改之后,重新启动应用,但是比速度比手动停止后再启动还要更快,更快指的不是节省出来的手工操作的时间。

添加一个pom依赖即可:

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

测试:
修改一个类文件,保存 => 服务器重启
修改一个配置文件,保存 => 服务器重启

排除静态资源:
spring默认,已经设置了

# Patterns that should be excluded from triggering a full restart.
spring.devtools.restart.exclude=META-INF/maven/**,META-INF/resources/**,resources/**,static/**,public/**,templates/**,**/*Test.class,**/*Tests.class,git.properties

# Amount of time (in milliseconds) to wait between polling for classpath changes.
spring.devtools.restart.poll-interval=1000

也可以在application.yml中自定义配置:

spring:
devtools:
restart:
exclude: static/**,public/**


举报

相关推荐

0 条评论