IllegalStateException with Projections in Spring Data Commons 3.3.3+
We've run into an issue when we upgraded to Spring Boot 3.3.3, and it looks like it's related to the change made in Spring Data Commons 3.3.3 (https://github.com/spring-projects/spring-data-commons/commit/431a1f5179ff161dc0a1318a677a1f1f199b982a) and the issue does persist in the 3.3.4 releases.
We're started getting org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Invoked method is not a property accessor exceptions from some of our Projections. Specifically, Projections that include an abstract MappedSuperclass, which we use for common auditing fields.
The underlying exception looks to be a IllegalStateException thrown by the org.springframework.data.projection.PropertyAccessingMethodInterceptor, where it can no longer match the proper accessors from the super class.
We're using Eclipse Temurin 22.0.2 and plain Java.
Attached is a small demo project that replicates the issue (uses a small PSQL database).
We did find switching the superclass declaration from abstract to public does mitigate the issue.
http://localhost:8080/books - error http://localhost:8080/books/1 - no error http://localhost:8080/books/1?projection=default - error
Thanks.
Closing as duplicate of #3697