diff --git a/web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java b/web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java index 0f9cebfa09..9d49bc72bd 100644 --- a/web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java +++ b/web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java @@ -20,6 +20,7 @@ import org.springframework.aot.hint.MemberCategory; import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.aot.hint.TypeReference; +import org.springframework.core.io.ClassPathResource; import org.springframework.security.web.access.expression.WebSecurityExpressionRoot; /** @@ -40,6 +41,12 @@ class WebMvcSecurityRuntimeHints implements RuntimeHintsRegistrar { TypeReference .of("org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler$SupplierCsrfToken"), MemberCategory.INVOKE_DECLARED_METHODS); + + ClassPathResource css = new ClassPathResource("org/springframework/security/default-ui.css"); + if (css.exists()) { + hints.resources().registerResource(css); + } + } } diff --git a/web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java b/web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java index 1c279457da..7ed25e570f 100644 --- a/web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java +++ b/web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java @@ -62,4 +62,10 @@ class WebMvcSecurityRuntimeHintsTests { .withMemberCategories(MemberCategory.INVOKE_DECLARED_METHODS)).accepts(this.hints); } + @Test + void cssHasHints() { + assertThat(RuntimeHintsPredicates.resource().forResource("org/springframework/security/default-ui.css")) + .accepts(this.hints); + } + }