Move registerResourceIfNecessary() to ResourceHints

See gh-29083
This commit is contained in:
Sam Brannen
2022-09-06 15:22:18 +02:00
parent 5c2859ffa7
commit 8fbd2141b7
6 changed files with 57 additions and 59 deletions

View File

@@ -20,7 +20,6 @@ import java.util.Arrays;
import java.util.List;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.support.RuntimeHintsUtils;
import org.springframework.core.annotation.MergedAnnotations;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.test.context.ActiveProfiles;
@@ -101,7 +100,7 @@ class StandardTestRuntimeHints implements TestRuntimeHintsRegistrar {
Arrays.stream(paths)
.filter(path -> path.startsWith(CLASSPATH_URL_PREFIX))
.map(resourceLoader::getResource)
.forEach(resource -> RuntimeHintsUtils.registerResourceIfNecessary(runtimeHints, resource));
.forEach(runtimeHints.resources()::registerResourceIfNecessary);
}
private void registerClasspathResourceDirectoryStructure(String directory, RuntimeHints runtimeHints) {

View File

@@ -28,7 +28,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.support.RuntimeHintsUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.core.io.ByteArrayResource;
@@ -397,7 +396,7 @@ public class SqlScriptsTestExecutionListener extends AbstractTestExecutionListen
Arrays.stream(paths)
.filter(path -> path.startsWith(CLASSPATH_URL_PREFIX))
.map(resourceLoader::getResource)
.forEach(resource -> RuntimeHintsUtils.registerResourceIfNecessary(runtimeHints, resource));
.forEach(runtimeHints.resources()::registerResourceIfNecessary);
}
}