SpringBoot 2.x Redis配置不使用默认JDK序列化,自定义配置使用Json序列化
自定义配置在config类,前面的类都是为了测试演示转换json成功没,所以可以直接跳过.
首先创建一个实体类实现Serializable接口:
public class Employee implements Serializable {
private Integer id;
private String lastName;
private String email;
private Integer gender;
private Integer dId;
public Employee() {
super();
}
public Employee(Integer id, String lastName, String email, Integer gender, Integer dId) {
super();
this.id = id;
this.lastName = lastName;
this.email = email;
this.gender = gender;
this.dId = dId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = la