springboot热启动

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/reed1991/article/details/85726896

1.在pom文件中添加maven依赖

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

2.将下面的代码是放在<build>  下面<plugins>里的

<plugin>
	<!--热部署配置-->
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-maven-plugin</artifactId>
	<configuration>
	<!--fork:如果没有该项配置,整个devtools不会起作用-->
	<fork>true</fork>
	</configuration>
</plugin>

3.File----》Setting---》complier---》勾选上Build Project automatically

4.快捷键 ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running

.

这样我们的热部署就完成了,可以再我们的项目中修改返回值,或者修改Mapping的value值后,在我们的页面中刷新试试。

修改前

在浏览器中访问

将100换成10,无需重启,再次在浏览器访问

我们的修改已经生效了,不用通过再关闭再开启项目查看了。

猜你喜欢

转载自blog.csdn.net/reed1991/article/details/85726896