可以看到是HashMap,那么是序列化的数据
那么我们来获得反序列化数据
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import redis.clients.jedis.Jedis;
public class RedisDeserializeDemo {
public static void main(String[] args) {
// Redis 服务器地址和端口号
String redisHost = "localhost";
int redisPort = 16379;
// Redis 认证密码
String redisPassword = "xxxxxxxxx"; // 替换为你的实际密码
// 创建Redis连接
Jedis jedis = new Jedis(redisHost, redisPort);
// 认证 Redis 连接
jedis.auth(redisPassword);
// 从Redis中获取序列化值
byte[] serializedValue = jedis.get("Basic_ConfiGuration_List_".getBytes());
// 反序列化Java对象
Object deserializedObject = deserialize(serializedValue);
// 输出反序列化后的Java对象信息
System.out.println(deserializedObject.toString());
// 关闭Redis连接
jedis.close();
}
public static Object deserialize(byte[] serializedObject) {
Object deserializedObject = null;
try {
ByteArrayInputStream byteIn = new ByteArrayInputStream(serializedObject);
ObjectInputStream in = new ObjectInputStream(byteIn);
deserializedObject = in.readObject();
in.close();
byteIn.close();
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
return deserializedObject;
}
}