您当前的位置: 首页 >  redis

java持续实践

暂无认证

  • 3浏览

    0关注

    746博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

org.springframework.data.redis.serializer.SerializationException 解决方案

java持续实践 发布时间:2018-12-30 18:51:18 ,浏览量:3

在使用Spring Data Redis的过程中,报了如下的异常

org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector

我的代码是把一个TreeSet集合存入了Redis中作为值. TreeSet集合的构造方法中有一个比较器的内部类. 之后的解决方案是把TreeSet集合的值 ,放到List中,再存入Redis就不会报错了. 调用list的addAll方法. 把TreeSet集合传入进去即可 lists.addAll(treeset);

关注
打赏
1658054974
查看更多评论
立即登录/注册

微信扫码登录

0.0425s