其中一个问题是RedisTemplate在反序列化时可能会遇到无效的子类型,并抛出异常。为了解决这个问题,我们可以使用Jackson库的配置来设置DeserializationFeature.FAIL_ON_INVALID_SUBTYPE。本文将介绍如何使用RedisTemplate设置DeserializationFeature.FAIL_ON_INVALID_SUBTYPE。 准备工作 在开始之前,我们需要确保以下几个条件已经满足:...
FAIL_ON_INVALID_SUBTYPE: importstaticorg.junit.jupiter.api.Assertions.assertEquals;importjava.util.List;importjava.util.Objects;importorg.junit.jupiter.api.Test;importcom.fasterxml.jackson.annotation.JsonSetter;importcom.fasterxml.jackson.annotation.JsonSubTypes;importcom.fasterxml.jackson.annotation.JsonTypeIn...