spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
55.27k stars 37.62k forks source link

Reject competing read and write accessors for `PropertyAccessor` and `IndexAccessor` in SpEL #32737

Open sbrannen opened 2 weeks ago

sbrannen commented 2 weeks ago

Overview

While working on #26478 and related issues, it became apparent that a developer can inadvertently register one PropertyAccessor for reading a given property and a second competing accessor for writing the same property, which can lead to improper behavior when a cached accessor is expected to be able to support both read and write access for a given property.

The same can happen with multiple competing IndexAccessor implementations.

We have therefore decided to reject competing read and write accessors for the same property or the same index for both PropertyAccessor and IndexAccessor, respectively, starting with Spring Framework 6.2.

Related Issues