Springboot项目热部署-Devtools

1.在pom.xml(如果是多模块,则此pom根据需要可设为具体模块)文件中添加

<dependency>
    <groupId>org.springframework.bootgroupId>
    <artifactId>spring-boot-devtoolsartifactId>
   <scope>runtimescope>
    <optional>trueoptional>
dependency>

2.在pom.xml(如果是多模块,则此pom为父工程文件)加入插件

<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.bootgroupId>
      <artifactId>spring-boot-maven-pluginartifactId>
      <configuration>
        <fork>truefork>
        <addResources>trueaddResources>
      configuration>
    plugin>
  plugins>
build>

3.IDEA设置自动编译

Springboot项目热部署-Devtools_第1张图片 

 4.在IDEA任意界面使用快捷键ctrl+shif+Alt+/打开如下菜单,点击第一个选项(1.Registry...)

Springboot项目热部署-Devtools_第2张图片

选择后会出现如下子菜单,勾选compiler.automake.allow.when.app.running与actionSystem.assertFocusAccessFromEdt

Springboot项目热部署-Devtools_第3张图片

5.重启IDEA。

 

你可能感兴趣的:(Springboot项目热部署-Devtools)