From f11e3f38770a628189f88f8c4134dd44ccb32e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Fri, 31 Oct 2025 12:28:01 +0100 Subject: [PATCH] Adapt to new GraalVM metadata format This commit updates our web resources patterns due to a change in the GraalVM metadata format. Previously a single `*` was considering a directory and its sub-folders. The same behavior now requires two `*`. Closes gh-47894 --- .../boot/autoconfigure/web/WebResourcesRuntimeHints.java | 2 +- .../boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHints.java b/core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHints.java index d299454c072..e6ab5818d3c 100644 --- a/core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHints.java +++ b/core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHints.java @@ -39,7 +39,7 @@ public class WebResourcesRuntimeHints implements RuntimeHintsRegistrar { ClassLoader classLoaderToUse = (classLoader != null) ? classLoader : getClass().getClassLoader(); String[] locations = DEFAULT_LOCATIONS.stream() .filter((candidate) -> classLoaderToUse.getResource(candidate) != null) - .map((location) -> location + "*") + .map((location) -> location + "**") .toArray(String[]::new); if (locations.length > 0) { hints.resources().registerPattern((hint) -> hint.includes(locations)); diff --git a/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java index 3947eee6352..4ed0705e420 100644 --- a/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java +++ b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebResourcesRuntimeHintsTests.java @@ -44,13 +44,13 @@ class WebResourcesRuntimeHintsTests { RuntimeHints hints = register( new TestClassLoader(List.of("META-INF/resources/", "resources/", "static/", "public/"))); assertThat(hints.resources().resourcePatternHints()).singleElement() - .satisfies(include("META-INF/resources/*", "resources/*", "static/*", "public/*")); + .satisfies(include("META-INF/resources/**", "resources/**", "static/**", "public/**")); } @Test void registerHintsWithOnlyStaticLocations() { RuntimeHints hints = register(new TestClassLoader(List.of("static/"))); - assertThat(hints.resources().resourcePatternHints()).singleElement().satisfies(include("static/*")); + assertThat(hints.resources().resourcePatternHints()).singleElement().satisfies(include("static/**")); } @Test