Intellij idea中
设置中Setting->Inspections->Serialization issues->Serializable class without ’serialVersionUID’
实体类继承Serializable接口之后,使用alt+enter快捷键可以自动创建序列化id
举例:
package entity;
import lombok.*;
import java.io.Serializable;
/**
* JavaBean实现Serializable接口
* @author loler
* @date 2018-6-22
*/
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Student implements Serializable {
private static final long serialVersionUID = 3065150715942860195L;
//学生id
private Integer id;
//姓名
private String name;
//年龄
private Integer age;
//年级
private Integer grade;
//主修专业
private String major;
//学校
private String school;
}