Skip to content

Rework Bean Overriding feature to better behave with TCF Context Caching #32884

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
simonbasle opened this issue May 23, 2024 · 1 comment
Closed
Assignees
Labels
in: test Issues in the test module type: enhancement A general enhancement
Milestone

Comments

@simonbasle
Copy link
Contributor

  • Field and Class should be avoided in elements that participate in the context cache key, but currently BeanOverrideContextCustomizer uses a Set<Class>
  • OverrideMetadata would be a candidate to represent logically equal override points, but it does store the Field for now
  • As a consequence of removing the Field from OverrideMetadata, we'd have to figure a way to accommodate for qualifiers. BeanFactory.isAutowireCandidate isn't such a good option anymore unless we can get away with storing these mappings in the BeanOverrideRegistrar somehow.

For context caching purposes, a good litmus test is to copy a test class that has the @SpringJUnitConfig annotation and run both test classes with the logging level of org.springframework.test.context.cache set to debug. The last logging statement about the number of cached contexts should then be 1, not 2.

@simonbasle simonbasle added in: test Issues in the test module type: enhancement A general enhancement status: waiting-for-internal-feedback An issue that needs input from a member or another Spring Team labels May 23, 2024
@simonbasle simonbasle added this to the 6.2.0-M4 milestone May 23, 2024
@simonbasle simonbasle self-assigned this May 23, 2024
@snicoll snicoll removed the status: waiting-for-internal-feedback An issue that needs input from a member or another Spring Team label May 29, 2024
@snicoll snicoll self-assigned this Jun 6, 2024
@snicoll
Copy link
Member

snicoll commented Jun 6, 2024

It turns out that the only sensible way to restore a correct use of the TCF cache is by passing the identified metadata to the object that needs it, and that make it fail with AOT.

The current status on main was changed to attempt to make the feature work with AOT. This confirms what was suggested in #32925 (comment).

@snicoll snicoll closed this as completed in 7916f74 Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants