From 338786bab9fa2c03b451d6a927ea6d29d8a81f18 Mon Sep 17 00:00:00 2001 From: gimgisu Date: Sat, 24 Jan 2026 14:01:41 +0900 Subject: [PATCH] @gisu1102 Align AOT hints with MemberCategory deprecation replacements - Replace DECLARED_FIELDS with ACCESS_DECLARED_FIELDS in runtime hints - Preserve 1:1 intent for Collections via registerType only - Keep INVOKE_* only where it existed before Closes spring-projectsgh-18432 Signed-off-by: gimgisu --- ...ionServerBeanRegistrationAotProcessor.java | 26 +++++++++++-------- ...OAuth2AuthorizationServerRuntimeHints.java | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/aot/hint/OAuth2AuthorizationServerBeanRegistrationAotProcessor.java b/oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/aot/hint/OAuth2AuthorizationServerBeanRegistrationAotProcessor.java index e5f9c0480d..75cb812bbc 100644 --- a/oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/aot/hint/OAuth2AuthorizationServerBeanRegistrationAotProcessor.java +++ b/oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/aot/hint/OAuth2AuthorizationServerBeanRegistrationAotProcessor.java @@ -116,14 +116,12 @@ class OAuth2AuthorizationServerBeanRegistrationAotProcessor implements BeanRegis private void registerHints(RuntimeHints hints) { // Collections -> UnmodifiableSet, UnmodifiableList, UnmodifiableMap, // UnmodifiableRandomAccessList, etc. - hints.reflection() - .registerType(Collections.class, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, - MemberCategory.INVOKE_DECLARED_METHODS); + hints.reflection().registerType(Collections.class); // HashSet hints.reflection() - .registerType(HashSet.class, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, - MemberCategory.INVOKE_DECLARED_METHODS); + .registerType(HashSet.class, MemberCategory.ACCESS_DECLARED_FIELDS, + MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS); hints.reflection() .registerTypes(Arrays.asList(TypeReference.of(AbstractAuthenticationToken.class), @@ -140,7 +138,8 @@ class OAuth2AuthorizationServerBeanRegistrationAotProcessor implements BeanRegis TypeReference.of(AuthorizationGrantType.class), TypeReference.of(OAuth2AuthorizationResponseType.class), TypeReference.of(OAuth2TokenFormat.class)), - (builder) -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, + (builder) -> builder.withMembers(MemberCategory.ACCESS_DECLARED_FIELDS, + MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS)); // Jackson Modules @@ -153,7 +152,8 @@ class OAuth2AuthorizationServerBeanRegistrationAotProcessor implements BeanRegis Arrays.asList(TypeReference.of(CoreJacksonModule.class), TypeReference.of(WebServletJacksonModule.class), TypeReference.of(OAuth2AuthorizationServerJacksonModule.class)), - (builder) -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, + (builder) -> builder.withMembers(MemberCategory.ACCESS_DECLARED_FIELDS, + MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS)); } @@ -216,7 +216,8 @@ class OAuth2AuthorizationServerBeanRegistrationAotProcessor implements BeanRegis hints.reflection() .registerType(TypeReference .of("org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken"), - (builder) -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, + (builder) -> builder.withMembers(MemberCategory.ACCESS_DECLARED_FIELDS, + MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS)); // Jackson Module @@ -224,7 +225,8 @@ class OAuth2AuthorizationServerBeanRegistrationAotProcessor implements BeanRegis hints.reflection() .registerType(TypeReference .of("org.springframework.security.oauth2.client.jackson2.OAuth2ClientJackson2Module"), - (builder) -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, + (builder) -> builder.withMembers(MemberCategory.ACCESS_DECLARED_FIELDS, + MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS)); } if (jackson3Present) { @@ -232,7 +234,8 @@ class OAuth2AuthorizationServerBeanRegistrationAotProcessor implements BeanRegis .registerType( TypeReference .of("org.springframework.security.oauth2.client.jackson.OAuth2ClientJacksonModule"), - (builder) -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, + (builder) -> builder.withMembers(MemberCategory.ACCESS_DECLARED_FIELDS, + MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS)); } @@ -279,7 +282,8 @@ class OAuth2AuthorizationServerBeanRegistrationAotProcessor implements BeanRegis Arrays.asList(TypeReference.of(CoreJackson2Module.class), TypeReference.of(WebServletJackson2Module.class), TypeReference.of(OAuth2AuthorizationServerJackson2Module.class)), - (builder) -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, + (builder) -> builder.withMembers(MemberCategory.ACCESS_DECLARED_FIELDS, + MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS)); } diff --git a/oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/aot/hint/OAuth2AuthorizationServerRuntimeHints.java b/oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/aot/hint/OAuth2AuthorizationServerRuntimeHints.java index f0d7c4148d..a9227faafc 100644 --- a/oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/aot/hint/OAuth2AuthorizationServerRuntimeHints.java +++ b/oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/aot/hint/OAuth2AuthorizationServerRuntimeHints.java @@ -47,7 +47,7 @@ class OAuth2AuthorizationServerRuntimeHints implements RuntimeHintsRegistrar { MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); hints.reflection() .registerType(OAuth2AuthorizationCodeRequestAuthenticationToken.class, - MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS); + MemberCategory.ACCESS_DECLARED_FIELDS); }