Lombok generated constructor not found for deserialization on POST requests [DATAREST-884] #1254
Comments
Oliver Drotbohm commented This seems to be an issue between Jackson and Lombok. I've already filed a related ticket (same effect but slightly different setup) here |
Kai Tödter commented Thanks, Oliver. |
Kai Tödter commented With Spring Boot 1.4.1 |
Robert Rackl commented I have the same problem. I am expsoing a JpaRepositry as spring-data-rest-hateoas REST service with the " I also have the parent-child relation between an "idea" in a given "area", ie. idea references area When I try to POST a new idea that references an already existing area like this {
"title": "Inserted Idea",
"description": "Very nice description",
"area": "/liquido/v2/areas/2"
} I also get the error message:
SOLVED! The solution is as you mentioned. But interestingly you have to add the @Data
@Entity
@NoArgsConstructor
@RequiredArgsConstructor(suppressConstructorProperties = true)
public class IdeaModel {
[...]
} SideRemark: It works the same with Lomboks AllArgsConstructor or RequiredArgsConstructor |
Robert Rackl commented I think this is related: https://jira.spring.io/browse/DATAREST-687 |
Kai Tödter opened DATAREST-884 and commented
With Spring Boot 1.3.7 the following is working, with Spring Boot 1.4.0 not anymore:
You find all the examples in this report at https://github.com/toedter/chatty/
Branches:
master -> Spring Boot 1.3.7 => working
Spring-Boot-1.4.0 -> Spring Boot 1.4.0 => not working
Consider 2 REST resources with repositories: User and ChatMessage
ChatMessage has a relation to user:
@ManyToOne
private User author;
With Spring Boot 1.3.7 it was possible to create a new ChatMessage including a relation to an existing user with one POST request, when http://localhost:8080/api/users/toedter_k points to a valid User resource :
This call gives the following error when using Spring Boot 1.4.0:
o.s.d.r.w.RepositoryRestExceptionHandler : Could not read document: Can not construct instance of com.toedter.chatty.server.boot.user.User: no String-argument constructor/factory method to deserialize from String value ('http://localhost:8080/api/users/toedter_k')
You find the corresponding test (Spring Restdocs) at
https://github.com/toedter/chatty/blob/master/subprojects/com.toedter.chatty.server.boot/src/test/java/com/toedter/chatty/server/boot/ApiDocumentation.java
Affects: 2.5.2 (Hopper SR2), 2.5.3 (Hopper SR3)
1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: