spring-projects / spring-projects/spring-framework

Reinstate proper caching for `OptimalPropertyAccessor` in SpEL

Open
#36,987 0 comments 0 reactions 1 assignee View on GitHub

@sbrannen is already working on this.

Since Jun 30, 2026.

in: core type: regression
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.