Thursday, 10 October 2019

Spring Boot Development Tools


Spring boot provides another tool set 'spring-boot-devtools' to make the developer experience more pleasant.

Features of Spring Boot Development Tools
a.   Property Defaults
b.   Automatic Restart
c.    Logging changes in condition evaluation
d.   Excluding Resources
e.   Watching Additional Paths
f.     Disabling restart
g.   Using a trigger file
h.   Customizing the Restart Classloader
i.     LiveReload
j.     Global Settings
k.    Support of dev tools in Remote Applications
l.      
How to enable Spring boot Dev tools?
Just add the spring-boot-devtools dependency in your build file.

In case of maven add below lines to pom.xml

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


In case of gradle add below lines to gradle file.
configurations {
  developmentOnly
  runtimeClasspath {
    extendsFrom developmentOnly
  }
}
dependencies {
  developmentOnly("org.springframework.boot:spring-boot-devtools")
}

Is Developer tools enabled in production?
Developer tools are automatically disabled when running a fully packaged application (Ex: Uber jar).

a.   If you launch the application using 'java -jar' command, then the application is started in separate class loader, so developer tools are automatically disabled.

b.   If you deploy your application in a container explicitly, then consider excluding devtools or set the -Dspring.devtools.restart.enabled=false system property.


Previous                                                    Next                                                    Home

No comments:

Post a Comment