Skip to content

AOT bean registrations miss reflection hints on property fields #31390

Closed
@bclozel

Description

@bclozel

See #31213 for background.

This issue is similar to #31293, but this time applies to missing reflection hints fields for property binding.
When the bean introspection processes a bean, we are reflecting on the fields to be bound with property values because of ReflectionUtils#findField calls. The missing reflection hint must be added on the right type, as the property value could be bound at any place in the type hierarchy.

When the hint is missing, we can get exceptions like:

org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access org.springframework.aop.framework.ProxyConfig.getDeclaredFields() without it being registered for runtime reflection. Add org.springframework.aop.framework.ProxyConfig.getDeclaredFields() 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.getDeclaredFields(DynamicHub.java:1124)
  org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:752)
  org.springframework.util.ReflectionUtils.findField(ReflectionUtils.java:600)
  org.springframework.util.ReflectionUtils.findField(ReflectionUtils.java:582)

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)theme: aotAn issue related to Ahead-of-time processingtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions