Skip to content

Native reflection configuration should consider beanClass attribute of bean definitions #28913

New issue

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

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

Already on GitHub? Sign in to your account

Closed
odrotbohm opened this issue Aug 2, 2022 · 2 comments
Assignees
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@odrotbohm
Copy link
Member

odrotbohm commented Aug 2, 2022

If the beanClass attribute of a bean definition is configured, it should be considered when scanning for necessary reflection information, ultimately ending up in reflect-config.json. Currently, code that sets this attribute on a bean definition has to manually register the required property backing methods for reflection.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 2, 2022
@snicoll
Copy link
Member

snicoll commented Aug 2, 2022

Use case is beanClass refers to a FactoryBean and resolvedTargetType to the bean that it produces. Right now our API assumes that getResolvedTargetType is the only candidate but factory beans-based scenario are a bit more complicated than that.

@snicoll snicoll added status: waiting-for-triage An issue we've not yet triaged or decided on and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 2, 2022
@snicoll
Copy link
Member

snicoll commented Aug 2, 2022

ConstructorOrFactoryMethodResolver which was copied over from Spring Native is able to identify that a BeanDefinition has a FactoryBean beanClass that is compatible with the resolvedTargetType set on the bean definition.

As a result, the proper instance supplier is generated.

However BeanDefinitionPropertiesCodeGenerator#addPropertyValues uses beanDefinition.getResolvableType() as the source for the property. If a matching method is not found, then no hint is added.

It would be nice if we had a way to connect those two so that they are consistent.

@snicoll snicoll added type: bug A general bug theme: aot An issue related to Ahead-of-time processing and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 2, 2022
@snicoll snicoll added this to the 6.0.0-M6 milestone Aug 2, 2022
@snicoll snicoll self-assigned this Aug 3, 2022
@snicoll snicoll closed this as completed in c9faff7 Aug 3, 2022
odrotbohm added a commit to spring-projects/spring-plugin that referenced this issue Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants