Skip to content

IllegalStateException with Projections in Spring Data Commons 3.3.3+ #3159

@Banesword

Description

@Banesword

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 (431a1f5) 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.

projectionissue.zip

http://localhost:8080/books - error
http://localhost:8080/books/1 - no error
http://localhost:8080/books/1?projection=default - error

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions