diff --git a/core/src/main/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrar.java b/core/src/main/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrar.java index 65742c93e7..0c430160b7 100644 --- a/core/src/main/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrar.java +++ b/core/src/main/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrar.java @@ -119,8 +119,10 @@ public final class AuthorizeReturnObjectHintsRegistrar implements SecurityHintsR } if (SpringProxy.class.isAssignableFrom(proxied)) { hints.reflection() - .registerType(proxied, MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.PUBLIC_FIELDS, - MemberCategory.DECLARED_FIELDS); + .registerType(clazz, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, + MemberCategory.INVOKE_DECLARED_METHODS) + .registerType(proxied, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, + MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS); } } diff --git a/core/src/test/java/org/springframework/security/aot/hint/AuthorizeReturnObjectCoreHintsRegistrarTests.java b/core/src/test/java/org/springframework/security/aot/hint/AuthorizeReturnObjectCoreHintsRegistrarTests.java index 0817114470..3f0043d903 100644 --- a/core/src/test/java/org/springframework/security/aot/hint/AuthorizeReturnObjectCoreHintsRegistrarTests.java +++ b/core/src/test/java/org/springframework/security/aot/hint/AuthorizeReturnObjectCoreHintsRegistrarTests.java @@ -46,8 +46,9 @@ public class AuthorizeReturnObjectCoreHintsRegistrarTests { context.refresh(); RuntimeHints hints = new RuntimeHints(); this.registrar.registerHints(hints, context.getBeanFactory()); - assertThat(hints.reflection().typeHints().map((hint) -> hint.getType().getName())) - .containsOnly(cglibClassName(MyObject.class), cglibClassName(MySubObject.class)); + assertThat(hints.reflection().typeHints().map((hint) -> hint.getType().getName())).containsOnly( + cglibClassName(MyObject.class), cglibClassName(MySubObject.class), MyObject.class.getName(), + MySubObject.class.getName()); assertThat(hints.proxies() .jdkProxyHints() .flatMap((hint) -> hint.getProxiedInterfaces().stream()) diff --git a/core/src/test/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrarTests.java b/core/src/test/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrarTests.java index 043e128d78..e0c1c24b1b 100644 --- a/core/src/test/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrarTests.java +++ b/core/src/test/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrarTests.java @@ -40,7 +40,7 @@ public class AuthorizeReturnObjectHintsRegistrarTests { RuntimeHints hints = new RuntimeHints(); registrar.registerHints(hints, null); assertThat(hints.reflection().typeHints().map((hint) -> hint.getType().getName())) - .containsOnly(cglibClassName(MyObject.class)); + .containsOnly(cglibClassName(MyObject.class), MyObject.class.getName()); assertThat(hints.proxies() .jdkProxyHints() .flatMap((hint) -> hint.getProxiedInterfaces().stream())