gpt4 book ai didi

java - 无法评估 Jackson 反序列化

转载 作者:行者123 更新时间:2023-11-30 06:08:46 27 4
gpt4 key购买 nike

添加到我的 DTO 对象后,我想将列表发送到服务器

private ImmutableList<T> elementsToAdd;

来自

import com.google.common.collect.ImmutableList;

将对象发送到 Controller 时会抛出异常

2018-06-04 21:41:31.645  WARN 508 --- [nio-8443-exec-6] .c.j.MappingJackson2HttpMessageConverter : Failed to evaluate Jackson deserialization for type [[simple type, class com.jonki.popcorn.common.dto.request.ContributionNewRequest<com.jonki.popcorn.common.dto.movie.Language>]]: com.fasterxml.jackson.databind.JsonMappingException: Cannot find a deserializer for non-concrete Collection type [collection type; class com.google.common.collect.ImmutableList, contains [simple type, class com.jonki.popcorn.common.dto.movie.Language]]

最佳答案

您需要配置 Jackson,以便它可以序列化/反序列化 Guava 不可变集合。请参阅https://github.com/FasterXML/jackson-datatypes-collections/tree/master/guava .

关于java - 无法评估 Jackson 反序列化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50687795/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com