gpt4 book ai didi

java - 如何序列化Java中的 map 以存储在Redis中?

转载 作者:IT王子 更新时间:2023-10-29 06:09:32 25 4
gpt4 key购买 nike

<分区>

我有以下类(class):

public class Document {

public String id;
public String date;
public Map<String, Keyword> keywords = new HashMap<>();

}

public class Keyword {

public String word;
public Map<String, Document> docs = new HashMap<>();

}

我想序列化 keywords HashMap 以便将其保存在 Redis 中。

我试过了 this但它抛出一个错误:

java.io.NotSerializableException:keyword

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