关于idea spring boot 热部署配置未生效问题

首先pom中必须配置 devtools

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

然后

 <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!-- 没有该配置,devtools 不生效 -->
                    <fork>true</fork>
                    <addResources>true</addResources>
                </configuration>
            </plugin>
        </plugins>
    </build>

这一点必须配置

                <configuration>
                    <!-- 没有该配置,devtools 不生效 -->
                    <fork>true</fork>
                    <addResources>true</addResources>
                </configuration>

若以上两处配置后还未生效。

对idea进行设置

  1. setting –> compiler ,将 Build project automatically 勾选上
  2. alt + shift + a (我的是ctrl+alt+shfit+/,反正两个总有一个管的吧)搜索 registry (第一个),弹出框后下拉找到compiler.automake.allow.when.app.running 勾选上即可。

这两步必须都做,并不是两种方法。注意:这是一种方法的两步骤。 勾选后应该是点击close按钮。

如果还未生效,可以尝试换下工作。

作者:AmbroseLe
链接:https://juejin.im/post/5b8e42f9518825273f07d396
来源:掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

猜你喜欢

转载自blog.csdn.net/qq_32786139/article/details/82386117