Spring Boot 2 Devtoolsο
Static Resource Cachingο
application.properties
#spring.freemarker.cache = true //set true in production environment
spring.freemarker.cache = false //set false in development environment; It is false by default.
//Other such properties
spring.thymeleaf.cache = false
spring.mustache.cache = false
spring.groovy.template.cache = false
Auto-refresh vs Auto-restart β Auto-refresh (or auto-load) refer to UI reload at browser to see static content changes. Auto-restart is referred to reloading the server side code and configurations followed by server restart.
Automatic UI refreshο
By default, live reload is enabled. If you wish to disable this feature for some reason, then set spring.devtools.livereload.enabled
property to false
.
application.properties
spring.devtools.livereload.enabled = false #Set false to disable live reload
Excluding Resources from auto-reloadο
By default, Auto-reload works on these paths:
/META-INF/maven
/META-INF/resources
/resources
/static
/public
/templates
If you want to disable auto-reload in browser for files in few of these paths, then use spring.devtools.restart.exclude
property. e.g.
spring.devtools.restart.exclude=static/**,public/**
Watching/Excluding Additional Pathsο
There may be few files not in classpath, but you still may want to watch those addtional files/paths to reload the application. To do so, use the spring.devtools.restart.additional-paths
property.
spring.devtools.restart.additional-paths=script/**
Similarily, If you want to keep those defaults and add additional exclusions, use the spring.devtools.restart.additional-exclude
property instead.
spring.devtools.restart.additional-exclude=styles/**
Automatic server restartο
Enable/disable logging of auto-configuration changesο
spring.devtools.restart.log-condition-evaluation-delta = false
Disabling Restartο
spring.devtools.restart.enabled = false
Using a Trigger Fileο
Use spring.devtools.restart.trigger-file
property to mention the trigger file for your application. It can be any external or internal file.
spring.devtools.restart.trigger-file = d:/workspace/restart-trigger.txt
Global settings fileο
To create global file, go to your systemβs userβs home directory and create a file named .spring-boot-devtools.properties
. (Please note that file name start with a dot). Not use this global property file to configure globally available options.
.spring-boot-devtools.properties
spring.devtools.restart.trigger-file = d:/workspace/restart-trigger.txt