Hello, we were trying to upgrade our springboot application from version 2.4.8 to 2.5.2, everything went well so far. then we encountered an Issue wit the spring-data-rest-repositories. We have a model properties annotated with @JsonProperty, but now it raises Nullpointers because it cannot find the mapping inside the deserializers. Previous version of Spring all went well.
POST http://localhost:8080/models
{
"doNotWant": "I don't want this!"
}
2021-07-13 17:38:22.021 DEBUG 21040 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : POST "/models", parameters={}
2021-07-13 17:38:34.424 WARN 21040 --- [nio-8080-exec-2] tion$ResourceSupportHttpMessageConverter : Failed to evaluate Jackson deserialization for type [[simple type, class org.springframework.data.rest.webmvc.PersistentEntityResource]]
java.lang.NullPointerException: null
at org.springframework.data.rest.webmvc.json.AggregateReferenceResolvingModule$AggregateReferenceDeserializerModifier.updateBuilder(AggregateReferenceResolvingModule.java:109) ~[spring-data-rest-webmvc-3.5.2.jar:3.5.2]
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:287) ~[jackson-databind-2.12.3.jar:2.12.3]
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:150) ~[jackson-databind-2.12.3.jar:2.12.3]
at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:414) ~[jackson-databind-2.12.3.jar:2.12.3]
at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349) ~[jackson-databind-2.12.3.jar:2.12.3]
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264) ~[jackson-databind-2.12.3.jar:2.12.3]
Here is a basic application to reproduce the case. it uses spring-data-rest and mongodb. https://github.com/UglyBarnacle/jsonpropertybug
I will add some Tests too, but wanted to report the bug first because it is kind of a hinderance for us. I hope the description is clear, I will further refine it. Thanks for having a look at it.
Comment From: wilkinsona
Thanks for the report, but Spring Data REST is managed as a separate project. You can report issues with it here. If you've already done some analysis and believe that the problem is caused by Spring Boot's configuration of Spring Data REST, please let us know and we can re-open the issue and take another look.
Comment From: philwebb
See https://github.com/spring-projects/spring-data-rest/issues/2041