diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java index 0cc22d32a86..9ccf1d3e105 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java @@ -90,8 +90,9 @@ public class DevToolsProperties { private Duration quietPeriod = Duration.ofMillis(400); /** - * Name of a specific file that, when changed, triggers the restart check. If not - * specified, any classpath file change triggers the restart. + * Name of a specific file that, when changed, triggers the restart check. Must be + * a simple name (without any path) of a file that appears on your classpath. If + * not specified, any classpath file change triggers the restart. */ private String triggerFile; diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc index bfc464cc958..dc2c60247e5 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc @@ -798,13 +798,38 @@ If you need to _completely_ disable restart support (for example, because it doe ==== Using a Trigger File If you work with an IDE that continuously compiles changed files, you might prefer to trigger restarts only at specific times. To do so, you can use a "`trigger file`", which is a special file that must be modified when you want to actually trigger a restart check. -Changing the file only triggers the check and the restart only occurs if Devtools has detected it has to do something. -The trigger file can be updated manually or with an IDE plugin. -To use a trigger file, set the `spring.devtools.restart.trigger-file` property to the path of your trigger file. +NOTE: Any update to the file file will trigger a check, but restart only actually occurs if Devtools has detected it has something to do. + +To use a trigger file, set the `spring.devtools.restart.trigger-file` property to the name (excluding any path) of your trigger file. +The trigger file must appear somewhere on your classpath. + +For example, if you have a project with the following structure: + +[indent=0] +---- + src + +- main + +- resources + +- .reloadtrigger +---- + +Then your `trigger-file` property would be: + +[source,properties,indent=0] +---- + spring.devtools.restart.trigger-file=.reloadtrigger +---- + +Restarts will now only happen when the `src/main/resources/.reloadtrigger` is updated. TIP: You might want to set `spring.devtools.restart.trigger-file` as a <>, so that all your projects behave in the same way. +Some IDEs have features that save you from needing to update your trigger file manually. +https://spring.io/tools[Spring Tools for Eclipse] and https://www.jetbrains.com/idea/[IntelliJ IDEA (Ultimate Edition)] both have such support. +With Spring Tools, you can use the "`reload`" button from the console view (as long as your `trigger-file` is named `.reloadtrigger`). +For IntelliJ, you can follow the https://www.jetbrains.com/help/idea/spring-boot.html#configure-application-update-policies-with-devtools[instructions in their documentation]. + [[using-boot-devtools-customizing-classload]]