欢迎来到我的的博客园,祝大家学有所成,早点实现自己的人生理想。

在SpringBoot中使用热部署(DevTools)

一、简介

  有时候我们开发完SpringBoot项目后,启动运行。但是经常发现代码需要反复修改,然后修改部分内容后需要再启动....这样太费时了,热部署就是用来解决这一问题。让你修改完代码后,能自动执行编译并运行。

 

二、工具

  IntelliJ IDEA、SpringBoot 2.0.4

三、步骤

  1、创建正常SpringBoot的Maven项目

  2、在需要热部署的项目中(或者在全局父Maven模块中)加入DevTools

  

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <version>2.0.4.RELEASE</version>
        </dependency>

    </dependencies>

  

  3、依次点开菜单 【File】-【Settings】-【Build,Execution,Deployment】-【Compiler】-勾选右侧的【Build project automatically】

  

  4、按下Ctrl+Shift+A,打开搜索,输入registry,并打开搜索到的该项设置。

  

  5、找到compiler.automake.allow.when.app.running项,并打勾。

  

  6、最重要的一步:重启IEDA。

 

 

  

posted @ 2018-09-12 15:55  宋兴柱  阅读(3058)  评论(0编辑  收藏  举报