2021.2からちょっと設定の方法が変わったみたいです
まずは、devtoolsを読み込むようにbuild.gradle
やpom.xml
に追記する。
build.gradle
dependencies {
developmentOnly 'org.springframework.boot:spring-boot-devtools'
}
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
あとはIntelliJにて以下を設定。
- Preferences > Build, Execution, Deployment > Compiler > Build project automaticallyにチェック
- Preferences > Advanced Settings > Allow auto-make to start even if developed application is currently runningにチェック
以上で、変更を検知してSpringBootが自動で再起動してくれるようになります!