Skip to content

AOT bean registrations miss reflection hints on public methods #31293

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
bclozel opened this issue Sep 22, 2023 · 0 comments
Closed

AOT bean registrations miss reflection hints on public methods #31293

bclozel opened this issue Sep 22, 2023 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Sep 22, 2023

See #31213 for background.

As seen in #31224, our reflection hints predicates were previously considering that org.springframework.aot.hint.MemberCategory#INTROSPECT_DECLARED_METHODS was somehow including org.springframework.aot.hint.MemberCategory#INTROSPECT_PUBLIC_METHODS. As documented in MemberCategory, this is not true because of inherited methods. This means that if Class#getMethods() is being called at runtime, it is required to register a INTROSPECT_PUBLIC_METHODS reflection hint.

We are missing such a hint in our core bean arrangement as we can see the following warnings when introspecting types and their inherited methods:

org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access org.springframework.aop.framework.autoproxy.InfrastructureAdvisorAutoProxyCreator.getMethods() without it being registered for runtime reflection. Add org.springframework.aop.framework.autoproxy.InfrastructureAdvisorAutoProxyCreator.getMethods() to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
  java.base@21/java.lang.Class.getMethods(DynamicHub.java:1004)
  org.springframework.beans.PropertyDescriptorUtils.determineBasicProperties(PropertyDescriptorUtils.java:62)
  org.springframework.beans.SimpleBeanInfoFactory.getBeanInfo(SimpleBeanInfoFactory.java:53)
  org.springframework.beans.CachedIntrospectionResults.getBeanInfo(CachedIntrospectionResults.java:228)
@bclozel bclozel added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing labels Sep 22, 2023
@bclozel bclozel added this to the 6.1.0-RC1 milestone Sep 22, 2023
@bclozel bclozel self-assigned this Sep 22, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant