20.2.3 Watching Additional Paths(监控额外的路径)
1 | You may want your application to be restarted or reloaded when you make |
有时候,当您修改的文件不在类路径下的时候,您可能也需要您的应用重启或者重载。这样做,使用spring.devtools.restart.additional-paths属性去配置额外的路径去监控它是否发生了改变,并根据这个改变去重启。您可以使用spring.devtools.restart.exclude属性,如前所述
控制额外路径下的更改是否触发完整重新启动或实时重新加载。
20.2.4 Disabling Restart(禁用重启)
1 | If you do not want to use the restart feature, you can disable |
如果您不喜欢用重启功能,您可以通过spring.devtools.restart.enabled属性禁用它。在大部分情况下,您可以在您的application.properties中设置它。(如果设置了它,始终会初始化“重启”类加载器,但是不监控文件的修改)。1
2
3
4If you need to completely disable restart support (for example,
because it does not work with a specific library), you need to set
the spring.devtools.restart.enabled System property to false before
calling SpringApplication.run(… ), as shown in the following example:
如果您想完全禁止重启功能(举个例子,它不能用于某个特殊的库),您需要在调用SpringApplication.run(… )之前设置spring.devtools.restart.enabled系统属性为fasle,如下:1
2
3
4public static void main(String[] args) {
System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(MyApp.class, args);
}