我是靠谱客的博主 无情寒风,这篇文章主要介绍Spring Boot入门教程-热部署,现在分享给大家,希望可以做个参考。

所谓热部署就是,项目启动后,你对代码做了修改,项目自动重新编译,不需要你重复启动,这样省去了这部分时间。

Spring Boot 有两种热部署的方法,一种是 springloader,一种是devtools。第一种我个人感觉有些繁琐,弃之不用,身为码农,只喜欢简单。所以这里只说一下springboot + devtools 如部署方式。

1.在pom.xml 中加入依赖。红色为加入的代码

 

<!--spring boot 热部署-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>

2.File -->>Setting-->>Build,Execution,Deployment-->>Compiler -->>Make project automatically  打勾 OK

 组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry” ,选中打勾 “compiler.automake.allow.when.app.running” 。

 

3.重启项目。更改下代码,看控制台,项目会重新编译。这样热部署就完成了。

 

 

 

 

最后

以上就是无情寒风最近收集整理的关于Spring Boot入门教程-热部署的全部内容,更多相关Spring内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(126)

评论列表共有 0 条评论

立即
投稿
返回
顶部