Spring-dev-toolsを使ってみた
Spring-dev-toolsの使い方を書いていく。
■設定方法
- 依存関係の追加
runtimeOnly 'org.springframework.boot:spring-boot-devtools' - これにする
outputDir = file("$buildDir/classes/java/main") - application.propertiesに下記を追加
spring.thymeleaf.prefix = file:src/main/resources/templates/ - IntelliJ設定の変更
Fire/Settings/Build, Execution, Deployment/Compilerを開く
"Build project automatically"にチェックを入れる - Registryの設定
“Controll + Shift + a + /” で表示されるダイアログの “Registry” を選択
”compiler.automake.allow.when.app.running” にチェックを入れる
"compiler.automake.postpone.when.idle.less.than"500ミリ秒に変更する
■確認作業
- アプリケーションを再起動する
- ログに”restartMain”が表示される
- コードを変更し保存する
- ブラウザをreloadし、変更を確認する
以上です。