springspring-boothot-reload

How does Spring Boot load changes in code without restarting the server?


In a Spring Boot application, if you make change in your code, is it possible to see them without restarting the server? If yes, how can that be achieved?


Solution

  • Add spring-boot-devtools module to your project, which includes LiveReload server which can be used to trigger a browser refresh whenever a resource has been changed.You can download browser extensions from livereload.com.

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>
    </dependencies>