在Settings中,找到Compiler选项,把Build project automatically前面打钩

同时按住ctrl+alt+shift+? 键,选择第一个选项 Registry...

找到compiler.automake.allow.when.app.running选项,打钩

Maven的pom.xml中需要加入的配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>2.5.0</version>
</dependency>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.7.RELEASE</version>
<configuration>
<fork>true</fork> <!-- 加入这个 -->
<mainClass>com.bruce.springboot.demo1.SpringbootDemo1Application</mainClass>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>

网友评论