Latest Developments In DevTools
Posted By Rahul Chauhan | 30-Apr-2018
Spring boot introduces a developer tool that makes the development of spring boot easier. spring boot developer tools come in the form of a library that can be added in the project dependency. If you are using the grades to build your project then you can add the following line in the build.gradle file:
or if you are using the maven to build your project then you can add the following dependency in the pom.xml file:
Capabilities of Devtools:
With the developer tool, any change to file on the classpath will trigger an application restart. They are some classpath resource that doesn't require an application restart when they change. Such as Thymeleaf templates, can be edited on the fly without restarting the application. The default set of restart path exclusions can be overridden by setting the spring.devtools.restart.exclude property.
Spring boot's developer tools integrate with LiveReload to eliminate the Refresh step. When the developer tool is active, Spring boot will restart the embedded LiveReload server that can trigger a browser refresh whenever a resource is changed. All you need to do is install the LiveReload plugin into your browser. If you'd like to disable the embedded LiveReload server, you can do so by setting spring.devtools.livereload.enabled to false:
The automatic restart and LiveReload features of the developer tools are also optionally available when running the applications remotely (such as when deployed on a server or in a cloud environment). In addition, Spring Boot’s developer tools enable remote debugging of Spring Boot applications. In a typical deployment, you won’t want the remote development feature enabled,
as it will hinder performance. But in special cases, such as when developing an application that’s deployed in a non-production environment set aside for development purposes, these tools can come in handy. This is especially useful if your application uses a cloud service that isn’t available in your local development environment. You must opt-in to remote development by setting a remote secret:
By setting this property, a server component is enabled in the running application to support remote development. This server will listen for requests asking it to accept incoming changes and will either restart the application or trigger a browser refresh.