Я получаю сообщение об ошибке
2020-01-28 18:19:21,311 DEBUG [http-nio-8069-exec-8] ServletInvocableHandlerMethod : Could not resolve parameter [0] in public org.springframework.http.ResponseEntity<org.test.dtos.TestResponse> org.test.controllers.TestController.testRoute(org.test.dtos.TestRequest): JSON parse error: Cannot construct instance of `org.test.dtos.TestChild` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('0'); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `org.test.dtos.TestChild` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('0')
at [Source: (PushbackInputStream); line: 5, column: 18] (through reference chain: org.test.dtos.TestRequest["children"]->org.test.dtos.TestChildWrapper["child"]->java.util.HashSet[0])
2020-01-28 18:19:21,314 WARN [http-nio-8069-exec-8] DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of `org.test.dtos.TestChild` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('0'); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `org.test.dtos.TestChild` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('0')
at [Source: (PushbackInputStream); line: 5, column: 18] (through reference chain: org.test.dtos.TestRequest["children"]->org.test.dtos.TestChildWrapper["child"]->java.util.HashSet[0])]
при отправке:
<?xml version="1.0" encoding="UTF-8"?>
<TestRequest>
<children>
<child>
<childStuffA>0</childStuffA>
<childStuffB>0</childStuffB>
<childStuffC>string</childStuffC>
</child>
</children>
<doubleProperty>0</doubleProperty>
<id>0</id>
<longProperty>0</longProperty>
<stringProperty>string</stringProperty>
</TestRequest>
на маршрут /test/api/apply
Я написал пример кода на GitHub с конкретная проблема.
Я использую Spring boot 2.2.4-RELEASE и Spring Cloud Hoxton.SR1, вы получите pom там. https://github.com/cmeon/spring-issue-test/tree/master