Allow additional paths that trigger a reload/restart to be configured

Previously, only folders on the classpath would be watched and used
to trigger a restart/reload of the application. This commit adds a
new property spring.devtools.restart.additional-paths that can be
used to configure additional paths that should be watched for
changes. When a change occurs in one of those paths a restart or
reload will be triggered, depending on the full restart exclude
patterns configured via the existing spring.devtools.restart.exclude
property.

Closes gh-3469
This commit is contained in:
Andy Wilkinson
2015-08-05 11:44:26 +01:00
parent 2a5a32b603
commit 4a25bae143
5 changed files with 61 additions and 2 deletions

View File

@@ -617,6 +617,7 @@ content into your application; rather pick only the properties that you need.
# ----------------------------------------
# DEVTOOLS ({sc-spring-boot-devtools}/autoconfigure/DevToolsProperties.{sc-ext}[DevToolsProperties])
spring.devtools.restart.additional-paths= # additional paths to watch for changes
spring.devtools.restart.enabled=true # enable automatic restart
spring.devtools.restart.exclude= # patterns that should be excluding for triggering a full restart
spring.devtools.restart.poll-interval= # amount of time (in milliseconds) to wait between polling for classpath changes

View File

@@ -894,12 +894,14 @@ commercially supported.
[[using-boot-devtools-restart-exclude]]
==== Excluding resources
Certain resources don't necessarily need to trigger a restart when they are changed. For
example, Thymeleaf templates can just be edited in-place. By default changing resources
in `/META-INF/maven`, `/META-INF/resources` ,`/resources` ,`/static` ,`/public` or
`/templates` will not trigger a restart. If you want to customize these exclusions you
can use the `spring.devtools.restart.exclude` property. For example, to exclude only
`/templates` will not trigger a restart but will trigger a
<<using-boot-devtools-livereload, live reload>>. If you want to customize these exclusions
you can use the `spring.devtools.restart.exclude` property. For example, to exclude only
`/static` and `/public` you would set the following:
[indent=0]
@@ -909,6 +911,18 @@ can use the `spring.devtools.restart.exclude` property. For example, to exclude
[[using-boot-devtools-restart-additional-paths]]
==== Watching additional paths
You may want your application to be restarted or reloaded when you make changes to files
that are not on the classpath. To do so, use the
`spring.devtools.restart.additional-paths` property to configure additional paths to watch
for changes. You can use the `spring.devtools.restart.exclude` property
<<using-boot-devtools-restart-exclude, described above>> to control whether changes
beneath the additional paths will trigger a full restart or just a
<<using-boot-devtools-livereload, live reload>>.
[[using-boot-devtools-restart-disable]]
==== Disabling restart
If you don't want to use the restart feature you can disable it using the