无法评估杰克逊的反序列化

时间:2018-06-04 19:48:08

标签: java json spring spring-mvc spring-boot

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

private ImmutableList<T> elementsToAdd;

import com.google.common.collect.ImmutableList;

将对象发送到控制器时会抛出

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]]

1 个答案:

答案 0 :(得分:1)

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