Skip to content

Commit

Permalink
Document how to hot reload in IntelliJ IDEA
Browse files Browse the repository at this point in the history
  • Loading branch information
miguno committed Sep 11, 2024
1 parent d91c94a commit 4b56d37
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 at 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):
Expand Down

0 comments on commit 4b56d37

Please sign in to comment.