Spring Boot入门三:使用devtools实现热部署

Eclipse下使用spring-tool-suite插件创建一个spring boot 工程,通过右键“Run As”—>”Spring Boot App”来启动工程,这时当我们对工程的内容进行修改的时候,需要重新操作刚才的步骤来重启功能,为提高开发效率,我们可以通过使用devtools来实现热部署,修改内容后直接重新加载启动。

一.启动devtools

创建一个springboot_devtools_demo工程,工程创建完成后,鼠标放在工程目录上点击右键“Spring Tools”—>”Add Boot Devtools”

点击完成后,pom.xml文件中会增减依赖:

1
2
3
4
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>

同时工程名称也会增加debtools标签:

这时对类,配置文件或页面进行修改,ctrl+s保存后会自动重新部署。

二.关闭devtools

如果想取消热部署,可以右键“Spring Tools”–>Remove Boot Devtools即可。

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×