えくぼんのテック備忘録

文系からエンジニアになった女です

Spring-dev-toolsを使ってみた

Spring-dev-toolsの使い方を書いていく。

 

■設定方法

  1. 依存関係の追加
    runtimeOnly 'org.springframework.boot:spring-boot-devtools'
  2. これにする
    outputDir = file("$buildDir/classes/java/main")
  3. application.propertiesに下記を追加
    spring.thymeleaf.prefix = file:src/main/resources/templates/
  4. IntelliJ設定の変更
    Fire/Settings/Build, Execution, Deployment/Compilerを開く
    "Build project automatically"にチェックを入れる
  5. Registryの設定
    “Controll + Shift + a + /” で表示されるダイアログの “Registry” を選択
    ”compiler.automake.allow.when.app.running” にチェックを入れる
    "compiler.automake.postpone.when.idle.less.than"500ミリ秒に変更する

 

■確認作業

  1. アプリケーションを再起動する
  2. ログに”restartMain”が表示される
  3. コードを変更し保存する
  4. ブラウザをreloadし、変更を確認する

以上です。