Wikipedia

Search results

Wednesday, March 13, 2019

Spring Boot Developer Toolsand Live Reload

When we develop web applications with Java, we had to restart the server to pick upall changes. This kills productivity. Spring Boot Developers Tools provides solutions toautomatically pick up changes without a complete server restart. Lets get productivewith Spring Boot Developer Tools


Add this dependency to your Spring Boot Project pom.xml

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
  • Restart the application.
  • You are all Set.
  • Go ahead and make a simple change to your controller. You would see that these
  • changes are automatically picked up.

What kind of changes does Spring Boot DeveloperTools pick up?
By default, any entry on the classpath that points to a folder will be monitored for changes.
Here are few important things to note:
These folders will not trigger reload by default
/META-INF/maven
/META-INF/resources
/resources
/static
/public
/templates
You can configure additional folders to scan.
application.properties
spring.devtools.restart.additional-paths = /path-to-folder
You can also configure folders to exclude.

spring.devtools.restart.exclude=static/**,public/**
.

s



You can also configure folders to exclude.
spring.devtools.restart.exclude=static/**,public/**



Auto refresh your browser with LiveReload
Spring Boot Developer Tools auto loads the changes to application. But if you are
developing a web application, you would need to refresh the browser to pickup the
change.
LiveReload aims to solve this problem
LiveReload offers extensions for browsers
Download from
http://livereload.com/extensions/
Once you install the LiveReload plugin for your browser, you would see that the page
auto refreshes when you make a change in application code.

No comments:

Post a Comment