Browse Source

Support package private methods on CGLIB proxies with AOT

Closes gh-29582
Closes gh-29764
pull/30034/head
Sébastien Deleuze 2 years ago
parent
commit
6825a842b5
  1. 3
      spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java
  2. 6
      spring-core/src/main/java/org/springframework/aot/hint/support/ClassHintUtils.java

3
spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java

@ -518,6 +518,9 @@ class AnnotationConfigApplicationContextTests { @@ -518,6 +518,9 @@ class AnnotationConfigApplicationContextTests {
.withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS))
.accepts(runtimeHints);
assertThat(RuntimeHintsPredicates.reflection().onType(CglibConfiguration.class)
.withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_DECLARED_METHODS))
.accepts(runtimeHints);
}
@Test

6
spring-core/src/main/java/org/springframework/aot/hint/support/ClassHintUtils.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,6 +34,7 @@ import org.springframework.util.ClassUtils; @@ -34,6 +34,7 @@ import org.springframework.util.ClassUtils;
* on the JDK and CGLIB proxy facilities and their core conventions.
*
* @author Juergen Hoeller
* @author Sebastien Deleuze
* @since 6.0.3
* @see org.springframework.aot.hint.ProxyHints
* @see org.springframework.aot.hint.ReflectionHints
@ -46,7 +47,8 @@ public abstract class ClassHintUtils { @@ -46,7 +47,8 @@ public abstract class ClassHintUtils {
MemberCategory.DECLARED_FIELDS);
private static final Consumer<TypeHint.Builder> asProxiedUserClass = hint ->
hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS);
hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS,
MemberCategory.INVOKE_DECLARED_METHODS);
/**

Loading…
Cancel
Save