spring-projects / spring-projects/spring-data-rest

BasePathAwareController and serailization of lazy-loaded collections in projections [DATAREST-646]

Open
#1,025 2 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: enhancement
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Holger Müller opened DATAREST-646 and commented

In my project I make use of @BasePathAwareController's to provide extensions to my SDR repositories. Everything works fine until I include projections over lazy-loaded collections of persistent entities. SDR than fails to serialize the response body with a LazyIntializationException.
I found, that the error does not occur if I annotate my controller with the equivalent but internal @RepositoryRestController annotation. Also the default serialization pipeline does not seem to be affected because the projections are serialized correctly when I query against the default repository endpoints. I've provided a testable version of the example project under the reference URL above


Affects: 2.3.1 (Fowler SR1), 2.4 RC1 (Gosling)

Reference URL: https://github.com/hmueller99/spring-data-examples/tree/master/rest/projections-issue-001

3 votes, 4 watchers

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.