spring-projects / spring-projects/spring-framework
Reinstate proper caching for `OptimalPropertyAccessor` in SpEL
@sbrannen is already working on this.
Since Jun 30, 2026.
- Dominant language
- Java
- Stars
- 60.2k
- Forks
- 38.8k
- Avg merge
- 5d 2h
- Merged PRs (30d)
- 27
Description
Overview
SpEL's OptimalPropertyAccessor "exists because looking up the appropriate reflective method or field on each read is not cheap." However, due to changes made in conjunction with #20324, a cached OptimalPropertyAccessor is never actually reused. The if (evalContext.getPropertyAccessors().contains(accessorToUse)) check always fails when accessorToUse is an OptimalPropertyAccessor, because an OptimalPropertyAccessor is never present in the evalContext.getPropertyAccessors() list.
Although this is technically a regression, we are only fixing this in 7.1 since no one has raised the issue since Spring Framework 4.3.10.
NOTE: This issue is not suitable for community contributions.
Related Issues
- #20324
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.