From 8d79f2608052788d758f21587d6703f5125fa259 Mon Sep 17 00:00:00 2001 From: "Michael G. Noll" Date: Wed, 11 Sep 2024 14:16:17 +0200 Subject: [PATCH] Document how to hot reload in IntelliJ IDEA --- README.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d27b24..04a9bbf 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,41 @@ $ ./mvnw spring-boot:run $ java -jar target/app.jar ``` -# Appendix: Usage with just +# Appendix + +## Hot reloading during development + +This project uses +[spring-boot-devtools](https://docs.spring.io/spring-boot/reference/using/devtools.html) +for fast, automatic application +[restarts](https://docs.spring.io/spring-boot/reference/using/devtools.html#using.devtools.restart) +after code changes. + +- This feature works both when running the application inside an IDE like + IntelliJ IDEA as well as when running the application in a terminal with + `./mvnw spring-boot:run`. +- Restarts will be triggered whenever files in the classpath changed, e.g., + after you re-built the project in IntelliJ IDEA or ran `./mvnw compile`. +- Be patient. After a file changed, it may take a few seconds for the refresh + to happen. + +In IntelliJ IDEA, you can also enable automatic project builds for even more +convenience, using the following settings. Then, whenever you modify a source +file, IDEA will automatically rebuild the project in the background and thus +trigger an automatic restart: + +- `Settings` > `Build, Execution, Deployment` > `Compiler`: + [X] Build project automatically +- `Settings` > `Advanced Settings`: + [X] Allow auto-make to start even if developed application is currently running + +**Restart vs. Reload:** If you want true +[reloads](https://docs.spring.io/spring-boot/reference/using/devtools.html#using.devtools.restart.restart-vs-reload) +that are even faster than automatic restarts, look Spring's [Live +Reload](https://docs.spring.io/spring-boot/reference/using/devtools.html#using.devtools.livereload) +feature and tools like [JRebel](https://jrebel.com/software/jrebel/). + +## Usage with just If you have [just](https://github.com/casey/just) installed, you can run the commands above more conveniently as per this project's [justfile](justfile):