SpringBoot下实现热部署

人盡茶涼 提交于 2020-08-11 09:02:45

前提:

    1. SpringBoot框架已经搭好。

    2. IDEA。

1. pom.xml

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <fork>true</fork>
    </configuration>
</plugin>

dependency放到dependencies下,plugin放到plugins下(build -> plugins)

2. application.yml

spring: 
  devtools:
    restart:
      enabled: true
      exclude: WEB-INF/**

3. 设置IDEA

        Mac:

1) IntelliJ IDEA -> Preferences -> Build,.... -> Compiler -> Build project automatically。
2) 按下command + shift + a,输入registry,找到compiler.automake.allow.when.app.running 。

        Win:

1) File -> Settings -> Compiler -> Build Project automatically
2) ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running

大功告成!

 

参考文章:https://www.cnblogs.com/liu2-/p/9118393.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!