spring-projects / spring-projects/spring-data-rest
RepositoryRestMvcConfiguration breaks Jackson support for JSR310 (javax.time) [DATAREST-465]
Open
@odrotbohm is already working on this.
Since Dec 31, 2020.
type: bug
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Sylvain LAURENT opened DATAREST-465 and commented
using spring boot 1.2.1 with jackson-datatype-jsr310 and spring-boot-starter-data-rest in my pom.xml.
I can POST a JSON object with one field mapped to a javax.time.Instant without any problem :
{ "theInstant" : "2015-01-22T12:00:25Z" }
As soon as I add @Import( RepositoryRestMvcConfiguration.class) on my spring boot Application class, the POST does not work any longer and I get the following error :
{
"timestamp" : 1421996311314,
"status" : 400,
"error" : "Bad Request",
"exception" : "org.springframework.http.converter.HttpMessageNotReadableException",
"message" : "Could not read JSON: Can not instantiate value of type [simple type, class java.time.Instant] from String value ('2015-01-22T12:00:25Z'); no single-String constructor/factory method\n at [Source: java.io.PushbackInputStream@4fe15843; line: 3, column: 24] (through reference chain: test.MyClass[\"theInstant\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class java.time.Instant] from String value ('2015-01-22T12:00:25Z'); no single-String constructor/factory method\n at [Source: java.io.PushbackInputStream@4fe15843; line: 3, column: 24] (through reference chain: test.MyClass[\"theInstant\"])"
}
Affects: 2.2.1 (Evans SR1)
3 votes, 4 watchers
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.