commit
877c65c714
|
@ -90,8 +90,9 @@ public class DevToolsProperties {
|
||||||
private Duration quietPeriod = Duration.ofMillis(400);
|
private Duration quietPeriod = Duration.ofMillis(400);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of a specific file that, when changed, triggers the restart check. If not
|
* Name of a specific file that, when changed, triggers the restart check. Must be
|
||||||
* specified, any classpath file change triggers the restart.
|
* 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;
|
private String triggerFile;
|
||||||
|
|
||||||
|
|
|
@ -796,13 +796,38 @@ If you need to _completely_ disable restart support (for example, because it doe
|
||||||
==== Using a Trigger File
|
==== 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.
|
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.
|
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 <<using-boot-devtools-globalsettings,global setting>>, so that all your projects behave in the same way.
|
TIP: You might want to set `spring.devtools.restart.trigger-file` as a <<using-boot-devtools-globalsettings,global setting>>, 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]]
|
[[using-boot-devtools-customizing-classload]]
|
||||||
|
|
Loading…
Reference in New Issue