spring boot热部署

 热部署:更改代码,不用重启springboot。

1、pom中引入依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>

 

2、插件配置fork=true

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

如果是eclipse,myeclipse继承IDE,这样就可以了。

如果是IDEA,还需要做些操作配置

a 选择File|Settings|Compiler命令,然后勾选Buildprojectautomatically复选框,低版本的IDEA请勾选
makeprojectautomatically复选框。
b 快捷键Ctrl+Shift+A,在输入框中输入Registry,勾选compile.automake.allow.when.app.running复
选框。

附注:为什么IDEA需要多配置后面这一步呢?因为IDEA默认不是自动编译的,需要我们手动去配置后才会自动

编译,而热部署依赖于项目的自动编译功能。
 
posted @ 2019-10-15 16:22  稚语希听  阅读(212)  评论(0编辑  收藏  举报