From bd5a05dcddb8e96d9ee3028dd53ca5a807419b09 Mon Sep 17 00:00:00 2001 From: Marcus Da Coregio Date: Tue, 23 Aug 2022 15:05:58 -0300 Subject: [PATCH] Polish CoreSecurityRuntimeHints --- .../aot/hint/CoreSecurityRuntimeHints.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/springframework/security/aot/hint/CoreSecurityRuntimeHints.java b/core/src/main/java/org/springframework/security/aot/hint/CoreSecurityRuntimeHints.java index cd1d357cc2..c807a51cc2 100644 --- a/core/src/main/java/org/springframework/security/aot/hint/CoreSecurityRuntimeHints.java +++ b/core/src/main/java/org/springframework/security/aot/hint/CoreSecurityRuntimeHints.java @@ -52,14 +52,22 @@ class CoreSecurityRuntimeHints implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { - hints.reflection().registerTypes(getDefaultAuthenticationExceptionEventPublisherTypes(), - (builder) -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)); + registerExceptionEventsHints(hints); + registerExpressionEvaluationHints(hints); + hints.resources().registerResourceBundle("org.springframework.security.messages"); + } + + private void registerExpressionEvaluationHints(RuntimeHints hints) { hints.reflection().registerTypes( List.of(TypeReference.of(SecurityExpressionOperations.class), TypeReference.of(SecurityExpressionRoot.class)), (builder) -> builder.withMembers(MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS)); - hints.resources().registerResourceBundle("org.springframework.security.messages"); + } + + private void registerExceptionEventsHints(RuntimeHints hints) { + hints.reflection().registerTypes(getDefaultAuthenticationExceptionEventPublisherTypes(), + (builder) -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)); } private List getDefaultAuthenticationExceptionEventPublisherTypes() {