spring-projects / spring-projects/spring-data-rest
PUT does not use the configured conversion service for key conversion [DATAREST-1253]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Ryon Day opened DATAREST-1253 and commented
For some reason, the hard-coded DefaultConversionService within PersistentEntityResourceHandlerMethodArgumentResolver is preventing deserializing the id in the URL to the id type.
The result of this is that PUT operations are made impossible.
The weird thing is that there are several points in the flow where the correct ConversionService is used, and the correct Converter is invoked to convert from String to the ID!
The exact error is:
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [com.ryonday.sdrputisbroke.domain.ThingieId]
In the sample project, I've explicitly registered a converter for this id type. It seems very misleading and confusing to hard-code a ConversionService with new, when Spring-Data-REST explicitly allows the end user to configure a ConversionService that ostensibly would be used throughout SDR.
I have created a project on GitHub with tests that illustrates this issue. There appears to be no workaround at this time.
Note that the version of SDR used with Spring Boot 1.5.x did not manifest this issue (although I noticed there is still a hard-coded Conversion Service in the same spot)
Affects: 3.0.7 (Kay SR7)
Reference URL: https://github.com/ryonday/DATAREST-1253
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.