mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-08 11:32:47 +00:00
Add runtime hints for CSS resource
This commit is contained in:
parent
2405a5b680
commit
98975a9b83
@ -20,6 +20,7 @@ import org.springframework.aot.hint.MemberCategory;
|
|||||||
import org.springframework.aot.hint.RuntimeHints;
|
import org.springframework.aot.hint.RuntimeHints;
|
||||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||||
import org.springframework.aot.hint.TypeReference;
|
import org.springframework.aot.hint.TypeReference;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.security.web.access.expression.WebSecurityExpressionRoot;
|
import org.springframework.security.web.access.expression.WebSecurityExpressionRoot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,6 +41,12 @@ class WebMvcSecurityRuntimeHints implements RuntimeHintsRegistrar {
|
|||||||
TypeReference
|
TypeReference
|
||||||
.of("org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler$SupplierCsrfToken"),
|
.of("org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler$SupplierCsrfToken"),
|
||||||
MemberCategory.INVOKE_DECLARED_METHODS);
|
MemberCategory.INVOKE_DECLARED_METHODS);
|
||||||
|
|
||||||
|
ClassPathResource css = new ClassPathResource("org/springframework/security/default-ui.css");
|
||||||
|
if (css.exists()) {
|
||||||
|
hints.resources().registerResource(css);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,4 +62,10 @@ class WebMvcSecurityRuntimeHintsTests {
|
|||||||
.withMemberCategories(MemberCategory.INVOKE_DECLARED_METHODS)).accepts(this.hints);
|
.withMemberCategories(MemberCategory.INVOKE_DECLARED_METHODS)).accepts(this.hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void cssHasHints() {
|
||||||
|
assertThat(RuntimeHintsPredicates.resource().forResource("org/springframework/security/default-ui.css"))
|
||||||
|
.accepts(this.hints);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user