spring-projects / spring-projects/spring-data-rest
ReplaceOperation can no longer be accessed outside from spring package [DATAREST-1151]
Open
@odrotbohm is already working on this.
Since Dec 31, 2020.
in: repository
status: feedback-provided
type: bug
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Christian Mayr opened DATAREST-1151 and commented
In my Spring Boot application I'm using org.springframework.data.rest.webmvc.json.patch.ReplaceOperation for creating a custom PATCH-operation, e.g.
public static Patch convertRequestToPatch(ServletServerHttpRequest request) {
ObjectMapper objectMapper = new ObjectMapper();
try {
InputStream inputStream = new IncomingRequest(request).getBody();
JsonNode requestJson = objectMapper.readTree(inputStream);
Iterator<Entry<String, JsonNode>> fields = requestJson.fields();
List<PatchOperation> patchOperations = new ArrayList<>();
while (fields.hasNext()) {
Entry<String, JsonNode> entry = fields.next();
patchOperations.add(new ReplaceOperation(entry.getKey(), entry.getValue().asText()));
}
return new Patch(patchOperations);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
which was working like a charm till Spring Boot 1.5.7, but with the recent 1.5.8 release the build is failing with
org.springframework.data.rest.webmvc.json.patch.ReplaceOperation is not public in org.springframework.data.rest.webmvc.json.patch; cannot be accessed from outside package
Any reasons on why the ReplaceOperation is no longer public? Is there a new best practice for my task?
Affects: 3.0 GA (Kay)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.