JSON parse error: Cannot construct instance of net.bugreport.domain.entities.SomethingCamelCase (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('/something_camel_cases/1'); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of net.bugreport.domain.entities.SomethingCamelCase (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('/something_camel_cases/1'){quote`}
I analyzed org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.AssociationUriResolvingDeserializerModifier#updateBuilder which is responsible for my issue :
Indeed, when getting the com.fasterxml.jackson.databind.deser.SettableBeanProperty, the name of the property is its JSON name, which is snake_case.
Whereas when looking for org.springframework.data.mapping.model.BasicPersistentEntity#getPersistentProperty, it cannot find it since in org.springframework.data.mapping.model.BasicPersistentEntity#propertyCache, the name is camelCase.
Code
As code is pretty heavy, containing pom.xml, few classes and their repositories, a test case and the @SpringBootApplication, naming strategy and a data set, I set up a GitHub repository to store it.
hypr2771 opened DATAREST-1361 and commented
What
Using :
spring.jackson.property-naming-strategy: SNAKE_CASE
spring-boot-starter-data-rest
I run into a
`
Affects: 3.1.6 (Lovelace SR6)
Reference URL: https://github.com/hypr2771/naming-strategy-issue
The text was updated successfully, but these errors were encountered: