Skip to content
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

Bean definition contribution includes attributes that are not used at runtime #28516

Closed
snicoll opened this issue May 24, 2022 · 5 comments
Closed
Assignees
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented May 24, 2022

A typical @Configuration-annotated bean include a org.springframework.context.annotation.ConfigurationClassPostProcessor.configurationClass attribute in generated code. This attribute is useless at runtime and should not be contributed.

In Spring Native, we took the decision of not writing those attributes and that didn't seem to matter so I don't know how much of those attributes are required.

cc @philwebb

@snicoll snicoll added type: bug A general bug theme: aot An issue related to Ahead-of-time processing labels May 24, 2022
@snicoll snicoll added this to the 6.0.0-M5 milestone May 24, 2022
@philwebb
Copy link
Member

If we want to remove all attributes entirely we can drop the BeanDefinitionPropertiesCodeGenerator.addAttributes method. Otherwise I guess we need some filter strategy so that the ConfigurationClassPostProcessor can contribute a filter that removes just those attributes.

@snicoll
Copy link
Member Author

snicoll commented May 29, 2022

Another option would be to find a way to opt-in for certain attributes. I think that keeping the feature and letting him custom implementations drive what they need is interesting.

I am not too sure if we need to exclude an attribute or include a specific attribute (with, perhaps a list of well-known ones we want to include/exclude). In Spring Native we don't use this at all and it's been going ok so far but I am sure we'll hit a problem at some point.

@snicoll snicoll modified the milestones: 6.0.0-M5, 6.0.0-M6 Jun 21, 2022
@snicoll
Copy link
Member Author

snicoll commented Jun 21, 2022

Moving to M6 as such an optimization of code generation is not a blocker for M5, even if it would have been nice to finalize this part of the API.

@snicoll
Copy link
Member Author

snicoll commented Jul 25, 2022

We don't really know what is mandatory and what isn't. It would be nice to make a decision so that teams can test their integration based on what we intend to do for 6.0

@snicoll snicoll self-assigned this Jul 26, 2022
@snicoll
Copy link
Member Author

snicoll commented Jul 27, 2022

We've decided to stop writing those attributes and get feedback on actual use of the attributes, if any. Based on that we can reconsider our support before GA.

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

2 participants