Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Spring Boot Application Live Reload (Hot Swap) With Intellij IDEA

DZone's Guide to

Spring Boot Application Live Reload (Hot Swap) With Intellij IDEA

Check out this quick code snippet to get hot swapping up and running for your Spring Boot app. Tired of having to exit out and restart after every change? No more.

· Java Zone ·
Free Resource

Take 60 minutes to understand the Power of the Actor Model with "Designing Reactive Systems: The Role Of Actors In Distributed Architecture". Brought to you in partnership with Lightbend.

While developing Spring Boot Applications using Intellij IDEA, it was so annoying to restart the Spring Boot app after each and every change. Spring Boot provides live reload (hot swap) of application out of the box using the following dependency.

<dependency>
    <groupid>org.springframework.boot</groupid>
    <artifactid>spring-boot-devtools</artifactid>
</dependency>


But it didn't live reload the application/container, and the hot deployment didn't work for changes. Further researching found that following changes needed to be done in order the hot deployment to be worked correctly.

1. Open the Settings --> Build-Execution-Deployment --> Compiler

    and enable the Make Project Automatically.

2. Then press ctrl+shift+A and search for the registry. In the registry, make the following configuration enabled.

compiler.automake.allow.when.app.running

3. Restart the IDE.

That's it! Now the hot deployment works, and you don't have to restart manually after each and every change.

Learn how the Actor model provides a simple but powerful way to design and implement reactive applications that can distribute work across clusters of cores and servers. Brought to you in partnership with Lightbend.

Topics:
spring boot ,intellij idea ,java ,microservices

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}