Remove skipping of spring-boot-* projects from DevTools restart triggers
Closes gh-23158
This commit is contained in:
parent
1c4b4cb0cd
commit
689d0c8307
|
@ -17,9 +17,6 @@
|
|||
package org.springframework.boot.devtools.restart.server;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -40,9 +37,6 @@ public class DefaultSourceDirectoryUrlFilter implements SourceDirectoryUrlFilter
|
|||
|
||||
private static final Pattern VERSION_PATTERN = Pattern.compile("^-\\d+(?:\\.\\d+)*(?:[.-].+)?$");
|
||||
|
||||
private static final Set<String> SKIPPED_PROJECTS = new HashSet<>(Arrays.asList("spring-boot",
|
||||
"spring-boot-devtools", "spring-boot-autoconfigure", "spring-boot-actuator", "spring-boot-starter"));
|
||||
|
||||
@Override
|
||||
public boolean isMatch(String sourceDirectory, URL url) {
|
||||
String jarName = getJarName(url);
|
||||
|
@ -73,10 +67,13 @@ public class DefaultSourceDirectoryUrlFilter implements SourceDirectoryUrlFilter
|
|||
}
|
||||
|
||||
private boolean isDirectoryMatch(String directory, String jarName) {
|
||||
if (!jarName.startsWith(directory) || SKIPPED_PROJECTS.contains(directory)) {
|
||||
if (!jarName.startsWith(directory)) {
|
||||
System.out.println(jarName + " does not start with " + directory);
|
||||
return false;
|
||||
}
|
||||
System.out.println(jarName + " starts with " + directory);
|
||||
String version = jarName.substring(directory.length());
|
||||
System.out.println("Checking version: " + version);
|
||||
return version.isEmpty() || VERSION_PATTERN.matcher(version).matches();
|
||||
}
|
||||
|
||||
|
|
|
@ -69,18 +69,6 @@ class DefaultSourceDirectoryUrlFilterTests {
|
|||
doTest("my-module/something/quite/quite/mad/");
|
||||
}
|
||||
|
||||
@Test
|
||||
void skippedProjects() throws Exception {
|
||||
String sourceDirectory = "/Users/me/code/spring-boot-samples/spring-boot-sample-devtools";
|
||||
URL jarUrl = new URL("jar:file:/Users/me/tmp/spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar!/");
|
||||
assertThat(this.filter.isMatch(sourceDirectory, jarUrl)).isTrue();
|
||||
URL nestedJarUrl = new URL("jar:file:/Users/me/tmp/spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar!/"
|
||||
+ "lib/spring-boot-1.3.0.BUILD-SNAPSHOT.jar!/");
|
||||
assertThat(this.filter.isMatch(sourceDirectory, nestedJarUrl)).isFalse();
|
||||
URL fileUrl = new URL("file:/Users/me/tmp/spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar");
|
||||
assertThat(this.filter.isMatch(sourceDirectory, fileUrl)).isTrue();
|
||||
}
|
||||
|
||||
private void doTest(String sourcePostfix) throws MalformedURLException {
|
||||
doTest(sourcePostfix, "my-module", true);
|
||||
doTest(sourcePostfix, "my-module-other", false);
|
||||
|
|
|
@ -602,8 +602,6 @@ Other devtools features (such as LiveReload and property overrides) can still be
|
|||
NOTE: DevTools relies on the application context's shutdown hook to close it during a restart.
|
||||
It does not work correctly if you have disabled the shutdown hook (`SpringApplication.setRegisterShutdownHook(false)`).
|
||||
|
||||
NOTE: When deciding if an entry on the classpath should trigger a restart when it changes, DevTools automatically ignores projects named `spring-boot`, `spring-boot-devtools`, `spring-boot-autoconfigure`, `spring-boot-actuator`, and `spring-boot-starter`.
|
||||
|
||||
NOTE: DevTools needs to customize the `ResourceLoader` used by the `ApplicationContext`.
|
||||
If your application provides one already, it is going to be wrapped.
|
||||
Direct override of the `getResource` method on the `ApplicationContext` is not supported.
|
||||
|
|
Loading…
Reference in New Issue